Do not try to set the locale in a stateless request
continuous-integration/drone/push Build is passing Details

Clément FRÉVILLE 11 months ago
parent 2259a53f9e
commit d6c4a40fc5

@ -17,6 +17,12 @@ final readonly class LocaleListener
public function onKernelRequest(RequestEvent $event): void
{
$request = $event->getRequest();
$this->localeSwitcher->setLocale($request->getSession()->get('_locale', 'en'));
if ($request->attributes->getBoolean('_stateless')) {
return;
}
$locale = $request->getSession()->get('_locale');
if ($locale !== null) {
$this->localeSwitcher->setLocale($locale);
}
}
}

Loading…
Cancel
Save