Download the PHP package sheepy85/l5-localization without Composer
On this page you can find all versions of the php package sheepy85/l5-localization. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sheepy85/l5-localization
More information about sheepy85/l5-localization
Files in sheepy85/l5-localization
Package l5-localization
Short Description Simple Localization Middleware for Laravel 5
License MIT
Informations about the package l5-localization
l5-localization
Simple Localization Middleware for Laravel 5 to make dynamic prefixed route names to the same controller actions.
Features
- Seo friendly url generation: example.com/news, example.com/en/news, example.com/es/noticias, example.com/fr/nouvelles
- Session stored Localization data.
- Locale prefix Route names
- Lang file stored Route url with model name
- Route Cache
Facade Alias : Locale
Setup
Step 1: Add to stack
Step 2: Use routes.php file
Step 3: Add the ServiceProvider
Step 4: Use file generator
to get the full list of Localization short codes use -l or --list
Examples
Example files in project folder.
Locale::locales()
looking for config/locale.php, set optional parameter to true
for raw url generation
Locale::router()
return Laravel Router instance and only accept [get, post, put, delete, patch]
methods
Generate route:cache for all of your languages
1 arg: If your routes lang file don't contain the route name, use as raw Uri 2 arg: Route name 3 arg: Action 4 arg: Localization short code
Result:
make Url
with helper to the session current locale:
or laravel's helper, notice need to comment out the original function in Illuminate\Foundation\helpers.php
file
Api Locale::
has()
Determine localization statusget()
Get current localizationset( $locale )
Set current localizationflush()
Unset Session variableexist( $locale )
Determine localization adjustablenotExist( $locale )
Determine localization not adjustablefallback()
Set fallback localizationlocale()
Get current localizationname()
Get current localization english namenative()
Get current localization native namescript()
Get current localization code scriptdirection()
Get current localization read directionlocales( $withNull = false )
Get available localizations, optional empty first rowcodes( $withNull = false )
Get available localization short codes, optional empty first row