Setting the Default Locale

Problem

You want to change the default locale.

Solution

Use the Lang::setLocale() method.

Lang::setLocale('es'); // switch to Spanish

Discussion

Difference between App::setLocale() and Lang::setLocale().

Lang::setLocale() only changes the locale in the currently loaded translation service.

App::setLocale() changes the currently loaded configuration value and calls Lang::setLocale() to update the translation service. Also, App::setLocale() fires a locale.changed event.

comments powered by Disqus