protected function detectAndApplyLanguage() {
        if ($this->config('autodetect', true)) {
            /** @var LanguageDetector $detector */
            $detector = $this->getLanguageDetector();
            $language = $detector->getLanguageFromCookie();
            if (!$language || strlen($language) > 5 || !in_array($language, $this->getSupportedLanguages(), true)) {
                $language = $detector->getDriver()->detect();
                if (!$language || strlen($language) > 5) {
                    $language = $this->request->getDefaultLocale();
                }
            }
            $this->applyNewLanguage($language, true);
        }
    }
protected function detectAndApplyLanguage() {
        if ($this->config('autodetect', true)) {
            /** @var LanguageDetector $detector */
            $detector = $this->getLanguageDetector();
            $language = $detector->getLanguageFromCookie();
            if (!$language || strlen($language) > 5 || !in_array($language, $this->getSupportedLanguages(), true)) {
                $language = $detector->getDriver()->detect();
                if (!$language || strlen($language) > 5) {
                    $language = $this->request->getDefaultLocale();
                }
            }
            $this->applyNewLanguage($language, true);
        }
    }
protected function detectAndApplyLanguage ( ) { if ( $ this -> config ( 'autodetect' , true ) ) { /** @var LanguageDetector $detector */ $ detector = $ this -> getLanguageDetector ( ) ; $ language = $ detector -> getLanguageFromCookie ( ) ; if ( ! $ language || strlen ( $ language ) > 5 || ! in_array ( $ language , $ this -> getSupportedLanguages ( ) , true ) ) { $ language = $ detector -> getDriver ( ) -> detect ( ) ; if ( ! $ language || strlen ( $ language ) > 5 ) { $ language = $ this -> request -> getDefaultLocale ( ) ; } } $ this -> applyNewLanguage ( $ language , true ) ; } }
Detect and apply language for the application.
Failsafe
Detect and apply language for the application . Failsafe