Register Multilingual Routes in Laravel

Register Multilingual Routes in Laravel

Laravel Multilingual Routes is a package by Chin Leung to register multilingual routes for your application. Instead of doing the following:

Route::get('/', 'ShowHomeController')->name('en.home');
Route::get('/fr', 'ShowHomeController')->name('fr.home');

You can accomplish the same thing with this package:

Route::multilingual('/', 'ShowHomeController')->name('home');

The package also ships with a middleware that automatically detects and changes the locale of the application based on the request.

protected $middlewareGroups = [
    'web' => [
        \ChinLeung\LaravelMultilingualRoutes\DetectRequestLocale::class,
        // ...
    ]
];

You can configure languages via the required chinleung/laravel-locales package:

// config/locales.php
'supported' => [
    'en',
    'es',
    'fr',
],

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.


Filed in: News / packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Developer (Full-Stack)
Munich
Volunteer Vision GmbH
Full-Stack Developer
Tampa
Nu Image Medical
Senior Software Developer
Remote (US ONLY)/Kenilworth, NJ
Diversified
Senior Back-end Laravel API Developer - Immediate Contract (Full Time)
Remote
ApproveMe // Document Signing
Web Development Project Manager
Houston, TX
Swyft Filings
Experienced Laravel/VueJS Developer (Freelance)
Remote (preferably in the US)
Prosperly LLC
Senior React / Laravel Developer
Remote
The C.A.S.E. Engineering Group