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 configapp.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 configapp.php
config file?
Thanks
2
Answers
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 withsetLocale($yourLocale)
.In order to get the current language code, write the following function:
In order to activate the activation of a new language, you can write the following function: