diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2018-10-15 08:31:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 08:31:42 +0000 |
commit | 5bb01c034424b56a0a0ae4bc34ae5bb9a514deba (patch) | |
tree | bb18d67c8ec03bf8abd24dc6ef2138c3f81f6fa5 /src/Wallabag/CoreBundle/Event/Listener | |
parent | 43b6f3a8a8173c47475632ca2869f190b552b5d6 (diff) | |
parent | 4d4147b228ac90f329fd2d40dd4fb60cb980328a (diff) | |
download | wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.tar.gz wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.tar.zst wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.zip |
Merge pull request #3216 from wallabag/change-locale-register
Added possibility to change locale from login/register pages
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/Listener')
-rw-r--r-- | src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php | 8 |
1 files changed, 5 insertions, 3 deletions
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; | |||
6 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; | 6 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Stores the locale of the user in the session after the | 9 | * Stores the locale of the user in the session after the login. |
10 | * login. This can be used by the LocaleListener afterwards. | 10 | * If no locale are defined (if user doesn't change it from the login screen), override it with the user's config one. |
11 | * | ||
12 | * This can be used by the LocaleListener afterwards. | ||
11 | * | 13 | * |
12 | * @see http://symfony.com/doc/master/cookbook/session/locale_sticky_session.html | 14 | * @see http://symfony.com/doc/master/cookbook/session/locale_sticky_session.html |
13 | */ | 15 | */ |
@@ -30,7 +32,7 @@ class UserLocaleListener | |||
30 | { | 32 | { |
31 | $user = $event->getAuthenticationToken()->getUser(); | 33 | $user = $event->getAuthenticationToken()->getUser(); |
32 | 34 | ||
33 | if (null !== $user->getConfig()->getLanguage()) { | 35 | if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) { |
34 | $this->session->set('_locale', $user->getConfig()->getLanguage()); | 36 | $this->session->set('_locale', $user->getConfig()->getLanguage()); |
35 | } | 37 | } |
36 | } | 38 | } |