Getting the Current Application Locale

Problem

You need to determine what locale your application is running in.

Solution

Use the App::getLocale() method.

if (App::getLocale() == 'en')
{
    echo "It's English!";
}

Discussion

You can also fetch this directly from the configuration.

Use Config::get('app.locale'). The value should be the same.

comments powered by Disqus