16/04
2018
Package designed for the Laravel Framework
The l5-location package allows for a dynamic translation in the Laravel framework, according to the available language definitions., (*1)
Execute the following command to get the latest version of the package:, (*2)
``` bash composer require alleycarvalho/l5-location, (*3)
### If the Laravel version **`>=`** 5.5 * ServiceProvider will be attached automatically. ### Other * Add service provider to the `'providers'` array in **`config/app.php`**: ``` php 'providers' => [ ⊠AlleyCarvalho\Location\Providers\LocationServiceProvider::class, ];
app/Http/kernel.php
:``` php protected $middlewareGroups = [ 'web' => [ ⊠\AlleyCarvalho\Location\Http\Middleware\Locale::class, ]; ];, (*4)
## Basic Usage > The translation can be dynamically changed using links referring to the available language in **`resources/lang/`**. 1. Example in **`resources/views/welcome.blade.php`**: ``` html <p>{{ trans('auth.failed') }}</p> <a href="/locale/pt-BR">PortuguĂȘs</a> <a href="/locale/en">InglĂȘs</a> <a href="/locale/fr">FrancĂȘs</a>
If the file package is not available in
resources/lang/
or in the package used, the translation will be done according to the configuration of'fallback_locale'
inconfig/app.php
, (*5)