public function setLocaleForAuthenticatedUser(InteractiveLoginEvent $event)
    {
        $user = $event->getAuthenticationToken()->getUser();
        if ($lang = $user->getLocale()) {
            $this->session->set('_locale', $lang);
        } else {
            $request = $event->getRequest();
            if ('unset' == $request->getLocale()) {
                $this->session->set('_locale', 'en');
            }
        }
    }
public function setLocaleForAuthenticatedUser(InteractiveLoginEvent $event)
    {
        $user = $event->getAuthenticationToken()->getUser();
        if ($lang = $user->getLocale()) {
            $this->session->set('_locale', $lang);
        } else {
            $request = $event->getRequest();
            if ('unset' == $request->getLocale()) {
                $this->session->set('_locale', 'en');
            }
        }
    }
public function setLocaleForAuthenticatedUser ( InteractiveLoginEvent $ event ) { $ user = $ event -> getAuthenticationToken ( ) -> getUser ( ) ; if ( $ lang = $ user -> getLocale ( ) ) { $ this -> session -> set ( '_locale' , $ lang ) ; } else { $ request = $ event -> getRequest ( ) ; if ( 'unset' == $ request -> getLocale ( ) ) { $ this -> session -> set ( '_locale' , 'en' ) ; } } }
security.interactive_login event. If a user chose a language in preferences, it would be set,
if not, a locale that was set by setLocaleForUnauthenticatedUser remains.

@param \Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event
security . interactive_login event . If a user chose a language in preferences it would be set if not a locale that was set by setLocaleForUnauthenticatedUser remains .