X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FEvent%2FListener%2FUserLocaleListener.php;h=1b5d61adaf5635a773f1b8f1b8c9dab3513fbab2;hb=48b0163d247554d7e2f1ec63b717c8216ea9ec59;hp=367cdfb00b46be2f49c928d2c94a8ce49ee8a01c;hpb=535bfcbe80de5d697b768c3a657214fdeff0eac3;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..1b5d61ad 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 */ @@ -23,14 +25,11 @@ class UserLocaleListener $this->session = $session; } - /** - * @param InteractiveLoginEvent $event - */ public function onInteractiveLogin(InteractiveLoginEvent $event) { $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()); } }