Example #1
0
 /**
  * Set the right locale via context.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     if (!$request->hasPreviousSession()) {
         return;
     }
     $request->setLocale($this->localeContext->getLocale() ?: $this->localeContext->getDefaultLocale());
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 protected function getDefaultLocale()
 {
     return $this->localeContext->getLocale();
 }
 /**
  * {@inheritdoc}
  */
 public function getCurrentLocale()
 {
     return $this->localeContext->getLocale();
 }