src/EventListener/LocaleListener.php
public function getPreferredLocale(Request $request)
    {
        $browserAcceptLanguages = $this->getBrowserAcceptLanguages($request);
        if (empty($browserAcceptLanguages)) {
            return $this->defaultLocale;
        }

        return $this->guessFrontendLocale($browserAcceptLanguages);
    }
public function getPreferredLocale(Request $request)
    {
        $browserAcceptLanguages = $this->getBrowserAcceptLanguages($request);
        if (empty($browserAcceptLanguages)) {
            return $this->defaultLocale;
        }

        return $this->guessFrontendLocale($browserAcceptLanguages);
    }
public function getPreferredLocale ( Request $ request ) { $ browserAcceptLanguages = $ this -> getBrowserAcceptLanguages ( $ request ) ; if ( empty ( $ browserAcceptLanguages ) ) { return $ this -> defaultLocale ; } return $ this -> guessFrontendLocale ( $ browserAcceptLanguages ) ; }
get preferred locale.

@param \Symfony\Component\HttpFoundation\Request $request

@return string
get preferred locale .