Configuring The Locale
The default language for your application is stored in the config/app.php
configuration file. You may modify this value to suit the needs of your
application. You may also change the active language at runtime using
the setLocale
method on the App
facade:
Route::get('welcome/{locale}', function ($locale) {
App::setLocale($locale);
//
});
You may configure a "fallback language", which will be used when the
active language does not contain a given translation string. Like the
default language, the fallback language is also configured in the config/app.php
configuration file:
'fallback_locale' => 'en',
Determining The Current Locale
You may use the getLocale
and isLocale
methods on the App
facade to determine the current locale or check if the locale is a given value:
$locale = App::getLocale();
if (App::isLocale('en')) {
//
}