core-bundle/src/EventListener/LocaleListener.php
private function getLocale(Request $request): string
    {
        if (null !== $request->attributes->get('_locale')) {
            return $this->formatLocaleId($request->attributes->get('_locale'));
        }

        return $request->getPreferredLanguage($this->availableLocales);
    }
private function getLocale(Request $request): string
    {
        if (null !== $request->attributes->get('_locale')) {
            return $this->formatLocaleId($request->attributes->get('_locale'));
        }

        return $request->getPreferredLanguage($this->availableLocales);
    }
private function getLocale ( Request $ request ) : string { if ( null !== $ request -> attributes -> get ( '_locale' ) ) { return $ this -> formatLocaleId ( $ request -> attributes -> get ( '_locale' ) ) ; } return $ request -> getPreferredLanguage ( $ this -> availableLocales ) ; }
Returns the locale from the request, the session or the HTTP header.
Returns the locale from the request the session or the HTTP header .