Checks SESSION, GET and Nip_Request and selects requested language
If language not requested, falls back to default

@return string
@deprecated Use getLocale instead
434394
public function getLanguage()
    {
        if (!$this->selectedLanguage) {
            $language = false;

            if (isset($_SESSION['language']) && $this->isValidLanguage($_SESSION['language'])) {
                $language = $_SESSION['language'];
            }

            $requestLanguage = $this->getRequest()->get('language');
            if ($requestLanguage && $this->isValidLanguage($requestLanguage)) {
                $language = $requestLanguage;
            }

            if ($language) {
                $this->setLanguage($language);
            } else {
                $this->setLanguage($this->getDefaultLanguage());
            }
        }

        return $this->selectedLanguage;
    }
866908
public static function getCurrentLanguage(){
		if(!self::$current_language){
			$language = CSession::get(self::CURRENT_LANGUAGE);
			if(!$language){
				$language = 'en_US';
			}
			self::$current_language = $language;
		}
		return self::$current_language;
	}
307994
public function getLocale(): string
    {
        if (is_null($this->locale)) {
            $this->locale = \Locale::getDefault();
        }

        return $this->locale;
    }
688871
private function getLanguage(Request $request)
    {
        $locale = $this->getRequestParameter($request, 'locale', false, null);

        if ($locale) {
            return $locale;
        }

        return $this->getRequestParameter($request, 'language', true);
    }
370817
public function getLocale()
    {
        $auth = $this->getView()
                     ->authentication();

        if ( $auth->hasIdentity() )
        {
            $locale = $auth->getIdentity()->locale;
        }
        else
        {
            $locale = Locale::getDefault();
        }

        return $locale;
    }
667234
public function chooseLanguage() {
        if ($this->_saveOnCookies &&
            $tmpLng = $this->getRequiredModules('cookies')->getCookie($this->_cookieName)
        ) {

            $this->_selectedLanguage = $tmpLng;
        } elseif (isset($this->_app)) {
            try {
                $this->_selectedLanguage = $this->_app->getConfig()->getConfigData('default_language');
            } catch (\pff\ConfigException $e) {
                $this->_selectedLanguage = $this->_defaultLang;
            }
        } else {
            $this->_selectedLanguage = $this->_defaultLang;
        }
    }
476449
def get_form_language(self, request, obj=None):
        
        if obj is not None:
            return obj.get_current_language()
        else:
            return self._language(request)
1074046
public function getEditLanguage()
    {
        if ($this->_iEditLanguageId === null) {
            if (!$this->isAdmin()) {
                $this->_iEditLanguageId = $this->getBaseLanguage();
            } else {
                $iLang = null;
                // choosing language ident
                // check if we really need to set the new language
                if ("saveinnlang" == \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView()->getFncName()) {
                    $iLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("new_lang");
                }
                $iLang = ($iLang === null) ? \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editlanguage') : $iLang;
                $iLang = ($iLang === null) ? \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('editlanguage') : $iLang;
                $iLang = ($iLang === null) ? $this->getBaseLanguage() : $iLang;

                // validating language
                $this->_iEditLanguageId = $this->validateLanguage($iLang);

                // writing to session
                \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('editlanguage', $this->_iEditLanguageId);
            }
        }

        return $this->_iEditLanguageId;
    }
827213
public function getCurrentLocale()
    {
        if (is_null($this->currentLocale)) {
            $this->setCurrentLocaleByContext();

            if (!is_admin() || Router::isFrontendAjax()) {
                $this->applyLocale();
            }
        }

        return $this->currentLocale;
    }
585376
public function getLangClient() {
        if (!array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER) || !$_SERVER['HTTP_ACCEPT_LANGUAGE']) {
            return Config::config()['user']['output']['lang'];
        }
        else {
            $langcode = (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
            $langcode = (!empty($langcode)) ? explode(";", $langcode) : $langcode;
            $langcode = (!empty($langcode['0'])) ? explode(",", $langcode['0']) : $langcode;
            $langcode = (!empty($langcode['0'])) ? explode("-", $langcode['0']) : $langcode;

            return $langcode['0'];
        }
    }
1107442
@Override
    public Locale getLocale() {
        if (null == this.locales) {
            this.locales = connection.getEncodingUtils().getLocales(this.request.getHeader("Accept-Language"));
        }
        if (this.locales.isEmpty()) {
            return null;
        }
        return this.locales.get(0);
    }
247463
public static function processLanguage($request)
    {

        if (LangHelper::countActiveLanguages() > 1)
        {
            //$lang = LangHelper::getFirstActiveLanguageCode(); //!! no
            $lang = Yii::$app->language; // current language

            // Get language from _GET parameter lang=XX if exists.
            // This language has low priority than as URL part: BASE_URL/XX/...
            $get = $request->get();
            if (!empty($get['lang'])) {
                $getLang = $get['lang'];
                if (LangHelper::isValidLangCode($getLang)) {
                    $lang = $getLang;
                }
            }           

            // Get language from URL if exists
            // and correct $request->pathInfo by cutting language part
            $pathInfo0 = $request->getPathInfo(); // pathInfo has not leading '/'
            //echo "orig pathInfo:'$pathInfo'<br>";
            $parts = explode('/', $pathInfo0, 2);
            if (!empty($parts[0])) {
                $langPart = $parts[0];
                if (LangHelper::isValidLangCode($langPart)) {
                    $pathInfo = substr($pathInfo0, strlen($langPart) + 1);
                    $lang = $langPart;
                    $request->setPathInfo($pathInfo);

                    $msg = "corrected pathInfo from '{$pathInfo0}' to '{$pathInfo}'<br>";
                    Yii::trace($msg);
                }
            }

            // Save language
            $lang = LangHelper::normalizeLangCode($lang);
            Yii::$app->language = $lang;
            LangHelper::setDefaultLanguage($lang);
            LangHelper::saveLanguageInSession($lang);

            // Correct $request->url by cutting language part if exists
            $urlManager = Yii::$app->urlManager;
            $baseUrl = $urlManager->showScriptName || !$urlManager->enablePrettyUrl ? $urlManager->getScriptUrl() : $urlManager->getBaseUrl();
            $url0 = $request->getUrl();
            if ($baseUrl !== '' && strpos($url0, $baseUrl) === 0) { // $url0 = $request->url begin with '/'
                $link = substr($url0, strlen($baseUrl));
                if (isset($langPart) && LangHelper::isValidLangCode($langPart)) {
                    $langPart = '/' . $langPart;
                    if (strpos($link, $langPart) === 0) {
                        $link = substr($link, strlen($langPart));
                    }
                    $url = $baseUrl . $link;
                    $request->setUrl($url);
                    $msg = "correct request->url from '{$url0}' to '{$url}'";
                    Yii::trace($msg);
                }
            }
        }    

    }
628069
public function getLanguage() {
        $options = $this->getOptions();
        $language = '';
        if (array_key_exists('language', $options)) {
            $language = $this->setLanguageCondition($options['language'], true);
        }
        if (array_key_exists('defaultLanguage', $options)) {
            $language = $this->setLanguageCondition($options['defaultLanguage'], true);
        }

        return $language;
    }
413463
public function getLanguage()
    {
        /** @var Session $oSession */
        $oSession = $this->getInstance("Session");
        /** @var Utilities $oUtils */
        $oUtils = $this->getInstance("Utilities");

        $iLanguage = $oUtils->getRequestVar("setup_lang", "post");

        if (isset($iLanguage)) {
            $oSession->setSessionParam('setup_lang', $iLanguage);
            $iLanguageSubmit = $oUtils->getRequestVar("setup_lang_submit", "post");
            if (isset($iLanguageSubmit)) {
                //updating setup language, so disabling redirect to next step, just reloading same step
                $_GET['istep'] = $_POST['istep'] = $this->getInstance("Setup")->getStep('STEP_WELCOME');
            }
        } elseif ($oSession->getSessionParam('setup_lang') === null) {
            $aLangs = ['en', 'de'];
            $sBrowserLang = strtolower(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2));
            $sBrowserLang = (in_array($sBrowserLang, $aLangs)) ? $sBrowserLang : $aLangs[0];
            $oSession->setSessionParam('setup_lang', $sBrowserLang);
        }

        return $oSession->getSessionParam('setup_lang');
    }
867076
public function getLocalization()
	{
		$data = parent::getLocalization();
		
		if (empty($data)) {
			$data = $this->detectRequestPageLocalization();
			
			$this->setLocalization($data);
		}
	
		return $data;
	}
469913
public function htmlLang()
    {
        $request = $this->requestStack->getCurrentRequest();
        $locale = $request ? $request->getLocale() : $this->locale;

        return str_replace('_', '-', $locale);
    }
396011
private function askDefaultLocale(): string
    {
        $io = new SymfonyStyle(new ArgvInput(), new ConsoleOutput());

        return $io->ask(
            'Please input the default locale for existing layouts',
            '',
            static function (string $locale): string {
                if (!Locales::exists($locale)) {
                    throw new RuntimeException('Specified locale is not valid');
                }

                return $locale;
            }
        );
    }