X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEvent%2FListener%2FUserLocaleListener.php;fp=src%2FWallabag%2FCoreBundle%2FEvent%2FListener%2FUserLocaleListener.php;h=dc1db5c7a009d03cbb78b54f577a4514e8bb008d;hb=5bb01c034424b56a0a0ae4bc34ae5bb9a514deba;hp=367cdfb00b46be2f49c928d2c94a8ce49ee8a01c;hpb=43b6f3a8a8173c47475632ca2869f190b552b5d6;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php index 367cdfb0..dc1db5c7 100644 --- a/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php +++ b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php @@ -6,8 +6,10 @@ use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; /** - * Stores the locale of the user in the session after the - * login. This can be used by the LocaleListener afterwards. + * Stores the locale of the user in the session after the login. + * If no locale are defined (if user doesn't change it from the login screen), override it with the user's config one. + * + * This can be used by the LocaleListener afterwards. * * @see http://symfony.com/doc/master/cookbook/session/locale_sticky_session.html */ @@ -30,7 +32,7 @@ class UserLocaleListener { $user = $event->getAuthenticationToken()->getUser(); - if (null !== $user->getConfig()->getLanguage()) { + if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) { $this->session->set('_locale', $user->getConfig()->getLanguage()); } }