birdsolutions/laravel-language is a Laravel package for laravel route localization package.
It currently has 0 GitHub stars and 82 downloads on Packagist (latest version 1.1).
Install it with composer require birdsolutions/laravel-language.
Discover more Laravel packages by birdsolutions
or browse all Laravel packages to compare alternatives.
Last updated
This package will help you localize your routes, set the language from the routes and add some nice functionality to it.
Installation
composer require birdsolutions/laravel-language
Service Provider Add the service provider to the config/app.php file
[
/*
* Package Service Providers...
*/
BirdSolutions\Language\Providers\LanguageServiceProvider::class,
]
Facade
'aliases' => [
...
'Language' => BirdSolutions\Language\Facades\Language::class,
]
Config Publish the configuration file.
php artisan vendor:publish --provider="BirdSolutions\Language\Providers\LanguageServiceProvider"
Middleware Add the language Middleware to the routeMiddleware array in kernel.php
protected $routeMiddleware = [
...
'language' => \BirdSolutions\Language\Middleware\LanguageMiddleware::class,
];
Routes
Route::group([
'prefix' => \Language::getLocale(),
'middleware' => 'language'
], function () {
// Add Localized routes here.
});
Change Language Manually
Route::any('/language', '\BirdSolutions\Language\Controllers\LanguageController@changeLanguage');
It will accept an input of language and set the language to the desired, you can send in get or post inputs.
<a href='/language?language=en'>English</a>