I'm trying "mcamara/laravel-localization" package to localize my app and it works as expected except for one small issue, the package seems to override the config('app.locale')
default value.
For instance if the default value of the locale
property in config\app.php
file is set to en
end I changed the application language to french with the language switcher then config('app.locale')
is evaluated to fr
instead of the default en
.
I hope the issue is clear so my question is: how can get the default locale as defined the config\app.php
config file?
Thanks
CodePudding user response:
whole point of that package is changing locale, no matter what the default locale is that package change it to whatever you config it to.
but you can get current locale anytime you want using currentLocale()
method of App facade and change it with setLocale($yourLocale)
.
CodePudding user response:
In order to get the current language code, write the following function:
app()->getLocale();
In order to activate the activation of a new language, you can write the following function:
app()->setLocale('fr');