Is it throwing and exception or is your question more about how to actually set the locale for translation to take place? If you are please paste the exception and your controller code.
Try running in the command line "php artisan routes" this is often where I start with any route problem.
Try this
Route::group(array('prefix' => '{lang}'), function() {
Route::get('users', 'UserController@showAll');
Route::get('user/{id}', 'UserController@showProfile');
});
Well, thank you! I try this, but the language setting doesn't works.
Route::group(array('prefix' => '{lang}'), function() {
App::setLocale($lang);
Route::get('users', 'UserController@showAll');
Route::get('user/{id}', 'UserController@showProfile');
});
$languages = array('nl','fr');
$locale = Request::segment(1);
if ( in_array($locale, $languages) ) {
App::setLocale($locale);
} else {
$locale = null;
}
Route::group(array('prefix' => $locale), function() {
//
});
http://forumsarchive.laravel.io/viewtopic.php?pid=35185#p35185
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community