src/Service/LanguageManager.php line 18
<?phpnamespace App\Service;use Symfony\Component\HttpKernel\KernelEvents;use Symfony\Component\HttpKernel\Event\RequestEvent;use Symfony\Component\EventDispatcher\EventSubscriberInterface;class LanguageManager implements EventSubscriberInterface{private $defautlLocale;public function __construct(string $defaultLocale){$this->defautlLocale = $defaultLocale;}public function onKernelRequest(RequestEvent $event){$request = $event->getRequest();if (!$request->hasPreviousSession()) {return;}if ($locale = $request->attributes->get('_locale')) {$request->getSession()->set('_locale', $locale);} else {$request->setLocale($request->getSession()->get('_locale', $this->defautlLocale));}}public static function getSubscribedEvents(){return [KernelEvents::REQUEST => [['onKernelRequest', 17]]];}}