0

I would like to implement multilanguage urls in Laravel 5.

This example seems working in Laravel 4: How to create multilingual translated routes in Laravel

foreach(Lang::get('routes') as $k => $v) {
   Route::pattern($k, $v);
}

I changed Lang::get() with trans(), since Lange::get() is no longer supported in L5, but I get an error: Invalid argument supplied for foreach() Any ideas how I can solve this? Thank you

Community
  • 1
  • 1
Steve
  • 1,036
  • 2
  • 13
  • 31
  • Try using https://github.com/mcamara/laravel-localization – Jilson Thomas Feb 09 '16 at 22:15
  • First I added the "mcamara/laravel-localization": "1.1.*" in my composer.json. Then I run composer install. After that I add this line Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class, to the config/app.php. But then I get an error that this file can not be found. Any ideas why? Thank you – Steve Feb 09 '16 at 22:30
  • Do `composer update` – Jilson Thomas Feb 09 '16 at 22:31
  • Thank you, composer update worked. After trying the example in the "Usage section" of adding the route group (['prefix' => LaravelLocalization::setLocale()]) I get a Laravel the exception : "default locale is not in the supportedLocales array" when calling url localhost/test. Any ideas why? – Steve Feb 09 '16 at 22:49

0 Answers0