Localizater Localization Package for Laravel

Localizater Localization Package for Laravel

Localizater is a Laravel package for wrapping routes in multiple locale prefixes.

Here’s an example from the readme of the basic usage when defining localized routes:

// routes/web.php
use Getsupercode\Localizater\Facades\Localizater;
use Illuminate\Support\Facades\Route;

Localizater::group(function () {
    Route::view('/', 'welcome')->name('welcome');
    Route::get('/user', 'UserController@index');
});

// Put other (Non-read) route actions outside the `Localizater::group` as you don't need to have multiple locales for those actions.

Route::post('/user', 'UserController@store');

This package will detect and change the locale of the application based on the request automatically via the provided middleware:

protected $middlewareGroups = [
    'web' => [
        \Getsupercode\Localizater\LocalizaterMiddleware::class,
        // ...
    ]
];

Finally, Localizater provides some route helpers to generate locale-based URLs:

// Route URL: example.com/fr/home
// Output: example.com/home
locale_route('home', 'en');

This package provides other configuration options such as defining a default locale, showing the locale in the URL for the default, and configuring the available locales.

You can learn more about this package, get full installation instructions, and view the source code on GitHub at Getsupercode/Localizater. The Laravel Localization documentation is another excellent resource for learning the localization support Laravel provides.

Filed in: News
Laravel News Partners

Laravel Jobs

Laravel Developer
Remote
Enjin
Senior Laravel Backend Engineer
Remote, USA Only
Kittyhawk.io, Inc.
Senior Laravel Developer
Remote, EU timezones only
Mindbeat
Experienced Laravel Developer
Remote
SolidProfessor
Full Time ad Remote - Experienced Laravel Developer
Europe Only
Thunderbite

Newsletter

Join 31,000+ others and never miss out on new tips, tutorials, and more.