public function getLangBrowserByCurrentUser($forceLang = '')
    {
        $allLangAvailable = $this->availableLanguages();
        $isLangAvailable = function ($langToCheck) use ($allLangAvailable) {
            return in_array($langToCheck, $allLangAvailable);
        };
        // we can force the lang
        if ($forceLang && $isLangAvailable($forceLang)) {
            return $forceLang;
        }
        // or set by session
        if (isset($_SESSION)
            && isset($_SESSION[self::CURRENT_LANG])
            && $isLangAvailable($_SESSION[self::CURRENT_LANG])
        ) {
            return $_SESSION[self::CURRENT_LANG];
        }

        $langBrowser = $this->config->languageBrowser();
        if ($isLangAvailable($langBrowser)) {
            return $langBrowser;
        }

        return $this->defaultLanguage();
    }
public function getLangBrowserByCurrentUser($forceLang = '')
    {
        $allLangAvailable = $this->availableLanguages();
        $isLangAvailable = function ($langToCheck) use ($allLangAvailable) {
            return in_array($langToCheck, $allLangAvailable);
        };
        // we can force the lang
        if ($forceLang && $isLangAvailable($forceLang)) {
            return $forceLang;
        }
        // or set by session
        if (isset($_SESSION)
            && isset($_SESSION[self::CURRENT_LANG])
            && $isLangAvailable($_SESSION[self::CURRENT_LANG])
        ) {
            return $_SESSION[self::CURRENT_LANG];
        }

        $langBrowser = $this->config->languageBrowser();
        if ($isLangAvailable($langBrowser)) {
            return $langBrowser;
        }

        return $this->defaultLanguage();
    }
public function getLangBrowserByCurrentUser ( $ forceLang = '' ) { $ allLangAvailable = $ this -> availableLanguages ( ) ; $ isLangAvailable = function ( $ langToCheck ) use ( $ allLangAvailable ) { return in_array ( $ langToCheck , $ allLangAvailable ) ; } ; // we can force the lang if ( $ forceLang && $ isLangAvailable ( $ forceLang ) ) { return $ forceLang ; } // or set by session if ( isset ( $ _SESSION ) && isset ( $ _SESSION [ self :: CURRENT_LANG ] ) && $ isLangAvailable ( $ _SESSION [ self :: CURRENT_LANG ] ) ) { return $ _SESSION [ self :: CURRENT_LANG ] ; } $ langBrowser = $ this -> config -> languageBrowser ( ) ; if ( $ isLangAvailable ( $ langBrowser ) ) { return $ langBrowser ; } return $ this -> defaultLanguage ( ) ; }
Return the lang by current user if it was established

@param string $forceLang
@return string Lang from the current user
Return the lang by current user if it was established