src/EventListener/LocaleListener.php
protected function matchLocaleInAvailableLanguages($locale)
    {
        foreach ($this->availableLanguages as $language) {
            // browser accept language matches an available language
            if ($locale == $language['locale']) {
                return $language['locale'];
            }
            // first part of browser accept language matches an available language
            if (substr($locale, 0, 2) == substr($language['locale'], 0, 2)) {
                return $language['locale'];
            }
        }

        return false;
    }
protected function matchLocaleInAvailableLanguages($locale)
    {
        foreach ($this->availableLanguages as $language) {
            // browser accept language matches an available language
            if ($locale == $language['locale']) {
                return $language['locale'];
            }
            // first part of browser accept language matches an available language
            if (substr($locale, 0, 2) == substr($language['locale'], 0, 2)) {
                return $language['locale'];
            }
        }

        return false;
    }
protected function matchLocaleInAvailableLanguages ( $ locale ) { foreach ( $ this -> availableLanguages as $ language ) { // browser accept language matches an available language if ( $ locale == $ language [ 'locale' ] ) { return $ language [ 'locale' ] ; } // first part of browser accept language matches an available language if ( substr ( $ locale , 0 , 2 ) == substr ( $ language [ 'locale' ] , 0 , 2 ) ) { return $ language [ 'locale' ] ; } } return false ; }
try to match browser language with available languages.

@param $locale

@return string
try to match browser language with available languages .