Returns current language.

@return string
765895
protected function getCurrentLanguage()
    {
        $request = $this->requestStack->getCurrentRequest();

        return $this->localeConverter->convertToEz($request->get('_locale'));
    }
730503
public function lang()
    {
        $accept_language = $this->getHeader('accept_language');

        $language = explode(',', explode(';', $accept_language)[0])[0];

        preg_match('/([a-z]+)/', $language, $match);

        return end($match);
    }
35850
public function current()
    {
        if ($this->mode & self::CURRENT_AS_RESOURCE) {
            return current($this->resources);
        }

        if ($this->mode & self::CURRENT_AS_PATH) {
            return current($this->resources)->getPath();
        }

        return current($this->resources)->getName();
    }
153212
public function getCurrentLocale()
    {
        if (!$this->currentLocale instanceof Locale
            || $this->currentLocale->getLanguage() === 'mul') {
            return $this->defaultLocale;
        }
        return $this->currentLocale;
    }
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');
    }
650832
public function current()
    {
        if ($this->currentLine === null) {
            $this->readLine();
        }

        try {
            $data = $this->parser->parseLine($this->currentLine);
        } catch (MatchException $exception) {
            $data = null;
        }

        return $data;
    }
542133
public function getLanguage()
    {
        if ($this->_language === null) {
            $this->_language = strtolower(Yii::$app->language);
        }
        return $this->_language;
    }
436900
public function current()
    {
        $data = current($this->data);
        return Query::createItemObject($data, $this->lang, $this->getLoadedModel($data['id']));
    }
963561
public function clientLang()
	{
		if ( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) {

			$language = explode(',', preg_replace('/(;\s?q=[0-9\.]+)|\s/i', '', strtolower(trim($_SERVER['HTTP_ACCEPT_LANGUAGE']))));
			return strtolower($language[0]);
		}

		return;
	}
1258637
public function languages()
    {
        $currentLocale = $this->translator()->getLocale();
        $languages = [];
        foreach ($this->translator()->locales() as $locale => $localeStruct) {
            /**
             * @see \Charcoal\Admin\Widget\FormSidebarWidget::languages()
             * @see \Charcoal\Property\LangProperty::localeChoices()
             */
            if (isset($localeStruct['name'])) {
                $label = $this->translator()->translation($localeStruct['name']);
            } else {
                $trans = 'locale.'.$locale;
                if ($trans === $this->translator()->translate($trans)) {
                    $label = strtoupper($locale);
                } else {
                    $label = $this->translator()->translation($trans);
                }
            }

            $languages[] = [
                'ident'   => $locale,
                'name'    => $this->translator()->translation($label),
                'current' => ($locale === $currentLocale)
            ];
        }

        return $languages;
    }
1012227
public function getLanguage()
    {
        if ($this->_language === null) {
            if ($this->defaultLanguageAttribute) {
                $this->_language = $this->owner->{$this->defaultLanguageAttribute};
            }
            //Try find best language from available
            $availableLanguages = $this->getAvailableLanguages();
            if ($availableLanguages) {
                if (in_array(Yii::$app->language, $availableLanguages)) {
                    $this->_language = Yii::$app->language;
                } elseif (Yii::$app->has('request')) {
                    $this->_language = Yii::$app->request->getPreferredLanguage($availableLanguages);
                }
            }
            //Use application language, because we don`t have any translation yet
            if (!$this->_language) {
                $this->_language = Yii::$app->language;
            }
        }
        return $this->_language;
    }
1228785
public static function getLanguage()
    {
        if (! self::$language) {
            self::$language = Language::findByCode(App::getLocale());
        }

        if (! self::$language) {
            abort(404, 'Language could not be found');
        }

        return self::$language;
    }
1040489
private function lang()
    {
        $lang = Yii::$app->language;
        if (Yii::$app->id === 'app-backend') {
            $lang = Yii::$app->wavecms->editedLanguage;
        }

        return $lang;
    }
436531
public function languageDetection() {
        $current_url = $this->getSession()->getCurrentUrl();
        $base_url = $this->getMinkParameter('base_url');
        // Checks whether the last symbol in the base_url is /, if not it adds it
        if (substr($base_url, -1) != "/") {
            $base_url = $base_url."/";
        }
        $base_url_length = strlen($base_url);
        //Get the 2 symbols in current URL after the base_url when Clean URLs is enabled
        $clean_url_language_code = substr($current_url,$base_url_length,2);
        $not_clean_url_language_code = substr($current_url,$base_url_length+3,2);
        if(in_array($clean_url_language_code,$this->languages_iso_codes) && substr($current_url,$base_url_length+2,1) == "/") {
            return $clean_url_language_code;
        }
        else if (in_array($not_clean_url_language_code,$this->languages_iso_codes) && substr($current_url,$base_url_length+5,1) == "/"){
            return $not_clean_url_language_code;
        }
        else return $this->multilingual_parameters['default_language'];
    }
673702
public function getLang()
    {
        if (is_cookie('lang')) {
            $language = (array_key_exists(get_cookie('lang'), $this->_languages)) ? get_cookie('lang') : __config()->config->language;
        } else {
            $language = __config()->config->language;
        }

        return $language;
    }
1272480
protected function getLanguages()
    {
        // Check if we have the data in the cache.
        if (null !== $this->languageCache) {
            return $this->languageCache;
        }

        $loadedLanguage = $this->getMetaModel()->getActiveLanguage();
        $languageValues = $this->getLanguageNames($loadedLanguage);
        $languages      = $this->getRealLanguages();
        $keys           = \array_keys($languages);
        $aux            = [];
        $real           = [];

        // Fetch real language values.
        foreach ($keys as $key) {
            if (isset($languageValues[$key])) {
                $aux[$key]  = \utf8_romanize($languageValues[$key]);
                $real[$key] = $languageValues[$key];
            }
        }

        // Add needed fallback values.
        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            $this->addNeededFallbackLanguages($keys, $aux, $real);
        }

        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            foreach ($keys as $key) {
                $aux[$key]  = \utf8_romanize($languages[$key]);
                $real[$key] = $languages[$key];
            }
        }

        \asort($aux);
        $return = [];
        foreach (\array_keys($aux) as $key) {
            $return[$key] = $real[$key];
        }

        // Switch back to the original FE language to not disturb the frontend.
        if ($loadedLanguage != $GLOBALS['TL_LANGUAGE']) {
            $event = new LoadLanguageFileEvent('languages', null, true);
            $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
        }

        return $this->languageCache = $return;
    }
885526
public function getLang()
    {
        if ($this->_lang === null) {
            $this->_lang = $this->item->lang;
        }
        
        return $this->_lang;
    }