Answer the question
In order to leave comments, you need to log in
How to correctly use prefixes for localization in Laravel 4.2?
app/routes.php
Route::group(['prefix' => '{lang}', 'before' => 'localization'], function()
{
Route::get('news', [
'as' => 'news',
'uses' => '[email protected]',
]);
Route::get('news/{id}', [
'as' => 'show_news',
'uses' => '[email protected]',
]);
});
Route::filter('localization', function()
{
App::setLocale(Route::input('lang'));
});
Answer the question
In order to leave comments, you need to log in
I figured it out myself. It turns out you need to explicitly pass the prefix
Thought Laravel does it automatically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question