This commit is contained in:
Jeremy Benoist
2022-11-23 15:51:33 +01:00
parent af6363bbbd
commit b7dba18cb2
41 changed files with 285 additions and 950 deletions

View File

@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Event\Listener;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Wallabag\UserBundle\Entity\User;
/**
* Stores the locale of the user in the session after the login.
@ -25,6 +26,7 @@ class UserLocaleListener
public function onInteractiveLogin(InteractiveLoginEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
\assert($user instanceof User);
if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) {
$this->session->set('_locale', $user->getConfig()->getLanguage());