package laravel-set-lang
Package to detect and set languages easily for Laravel
bastienbot/laravel-set-lang
Package to detect and set languages easily for Laravel
- Monday, January 9, 2017
- by bastienbot
- Repository
- 1 Watchers
- 0 Stars
- 122 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 4 % Grown
Laravel set Lang
Infos
This package is only compatible with Laravel 5.1+
This package has two purposes :
* Setting by default the language to the client browser language. Fallback language is english
* Providing routes and a service provider to set the user's language choice in a cookie and retrieve it on load, (*1)
Usage
- Go to you Laravel project folder in your favorite terminal
- Execute :
composer require bastienbot/laravel-set-lang dev-master
- Add the following line to the
config/app.php
:
'providers' => [
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
...
...
...
Bastienbot\LaravelSetLang\LangServiceProvider::class,
- Now you just need to create the links in HTML in your view(s), the anchors being :
/lang/{lang}
. {lang}
should be a string, ex : en
, fr
, etc...
dev-master
9999999-dev
Package to detect and set languages easily for Laravel
Sources
Download
by
Bastien Botella
0.5
0.5.0.0
Lib to detect and set languages easily for Laravel
Sources
Download
by
Bastien Botella
v0.2
0.2.0.0
Lib to detect and set languages easily for Laravel
Sources
Download
by
Bastien Botella
v0.1
0.1.0.0
Lib to detect and set languages easily for Laravel
Sources
Download
by
Bastien Botella