Laravel Multilingual Routes is a package by Chin Leung to register multilingual routes for your application. Instead of doing the following:
1Route::get('/', 'ShowHomeController')->name('en.home');2Route::get('/fr', 'ShowHomeController')->name('fr.home');
You can accomplish the same thing with this package:
The package also ships with a middleware that automatically detects and changes the locale of the application based on the request.
1protected $middlewareGroups = [2 'web' => [3 \ChinLeung\LaravelMultilingualRoutes\DetectRequestLocale::class,4 // ...5 ]6];
You can configure languages via the required chinleung/laravel-locales package:
1// config/locales.php2'supported' => [3 'en',4 'es',5 'fr',6],
Be sure the check out the package’s readme, which is full of examples of everything the multilingual package can do. You can learn more about this package, get full installation instructions, and view the source code on GitHub at chinleung/laravel-multilingual-routes.