Listening for Locale Changes

Problem

You want to listen for locale changes within your application.

Solution

Listen for the locale.changed event.

When fired, the event passes the new locale.

Event::listen('locale.changed', function($locale)
{
    echo "Locale changed to ", $locale;
});

Discussion

This event is fired when App::setLocale() is called.

See Setting the Default Locale.

comments powered by Disqus