public function setPjaxRequestLocale(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        if (!$event->isMasterRequest() || !$this->requestMatcher->matches($request)) {
            return;
        }

        $request->setLocale($request->getPreferredLanguage());
        $request->attributes->set('_locale', $request->getPreferredLanguage());
    }
public function setPjaxRequestLocale(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        if (!$event->isMasterRequest() || !$this->requestMatcher->matches($request)) {
            return;
        }

        $request->setLocale($request->getPreferredLanguage());
        $request->attributes->set('_locale', $request->getPreferredLanguage());
    }
public function setPjaxRequestLocale ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; if ( ! $ event -> isMasterRequest ( ) || ! $ this -> requestMatcher -> matches ( $ request ) ) { return ; } $ request -> setLocale ( $ request -> getPreferredLanguage ( ) ) ; $ request -> attributes -> set ( '_locale' , $ request -> getPreferredLanguage ( ) ) ; }
On pjax requests, sets the request's locale from the browser's accept-language header.
@param GetResponseEvent $event
On pjax requests sets the request s locale from the browser s accept - language header .