Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

up.......

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Try this

Route::group(array('prefix' => '{lang}'), function() {
    Route::get('users', 'UserController@showAll');
    Route::get('user/{id}', 'UserController@showProfile');
});
Last updated 2 years ago.
0

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');
});
Last updated 2 years ago.
0
$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

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lovePizza lovepizza Joined 13 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.