Download the PHP package torann/localization without Composer
On this page you can find all versions of the php package torann/localization. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download torann/localization
More information about torann/localization
Files in torann/localization
Package localization
Short Description Simple subdomain localization for Laravel.
License BSD-2-Clause
Informations about the package localization
Laravel Localization - Simplified
Simplified localization for Laravel based on the application's subdomain.
Table of Contents
- Installation
- Composer
- Laravel
- Methods
- Helpers
- Determining Locale
- License
- Localization on Packagist
- Localization on GitHub
Installation
Composer
From the command line run:
Laravel
Once installed you need to register the service provider with the application. Open up config/app.php
and find the providers
key.
Publish the configurations
Run this on the command line from the root of your project:
A configuration file will be published to config/localization.php
.
Methods
The following methods are available:
getDefaultLocale(): string
getCurrentLocale(): string
setLocale(string $locale = null): string|null
getLocales(): array
getLocale(string $key, mixed $default = null): mixed
getLocaleDirection(string $locale = 'current'): string
getLocaleKeys(): array
getLocalizedURL(string $url = null, mixed $locale = false, array $extra = []): string
isSupported(mixed $key): bool
getConfig(string $key, mixed $default = null): mixed
Helpers
Laravel Localization comes with a few helper methods
localization()
Returns the Torann\Localization\LocaleManager
instance.
localize_url($url = null, $locale = null, $attributes = []): string
Returns the given URL adapted to provided locale.
Determining Locale
By Subdomain
For this to work the subdomain needs to match an enabled supported locale key.
By Host
When the given subdomain is determined to not be valid the system can then set the locale depending on the current host. You'll need to set a map of your application's locales to hosts using the hosts configuration option.
License
Localization is open-sourced software licensed under the BSD 2-Clause License.
All versions of localization with dependencies
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/routing Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0