Gets the current language.

@param string $default The default language, defaults to `en`
@return string The current language if available, otherwise the default one
543248
public function getLanguage(string $default = null): string {
    $language = $default ?: 'en';

    if (TYPO3_MODE === 'FE') {
      if (isset($GLOBALS['TSFE']->lang)) {
        $language = $GLOBALS['TSFE']->lang;
      }
    } elseif (is_object($GLOBALS['LANG'])) {
      if (isset($GLOBALS['LANG']->lang)) {
        $language = $GLOBALS['LANG']->lang;
      }
    }

    // if (TYPO3_MODE === 'FE') {
    //   if (isset($GLOBALS['TSFE']->config['config']['language'])) {
    //     $language = $GLOBALS['TSFE']->config['config']['language'];
    //   }
    // } elseif (strlen($GLOBALS['BE_USER']->uc['lang']) > 0) {
    //   $language = $GLOBALS['BE_USER']->uc['lang'];
    // }

    return $language;
  }
810599
public function getLanguage() {
        if (!session_id()) {
            if ($this->sessionManager) {
                $this->sessionManager->start();
            }
        }
		if (!isset($_SESSION['_fine_I18n_language'])){
			$this->setLanguage('default');
		}
		return $_SESSION['_fine_I18n_language'];
	}
105956
public function setDefaultFont($default = null)
    {
        $old = $this->_defaultFont;
        $this->_defaultFont = $default;
        if ($default) $this->value['font-family'] = $default;
        return $old;
    }
638062
public function isPrettyName( $default = null ) {

		$prop = $this->properties[ self::PROP_NAME_PRETTY ];

		if( isset( $prop ) && strlen( $prop ) > 0 ) {

			return $prop;
		}

		return $default;
	}
782513
protected function getLanguage()
    {
        $output = [];
        // Get the language that be for default.
        $default_id = $this->languageManager->getDefaultLanguage()->getId();
        foreach ($this->languageManager->getLanguages() as $key => $value) {
            if ($default_id == $key) {
                $output[] = '';
            } else {
                $output[] = 'language.' . $value->getId();
            }
        }
        return $output;
    }
504877
public function getDefault()
    {
        $sDefault  = $this->oCi->config->item('languages_default');
        $oLanguage = $this->getByCode($sDefault);

        return !empty($oLanguage) ? $oLanguage : false;
    }
939027
public static function getDefault($domain = null)
    {
        // Get by domain if it exists and has a default
        $domainObject = Domain::getByDomain($domain);
        if ($domainObject) {
            $default = $domainObject->DefaultLocale();
            if ($default) {
                return $default;
            }
        }

        // Get explicit or implicit default
        $locales = static::getLocales();
        return $locales->filter('IsGlobalDefault', 1)->first()
            ?: $locales->first();
    }
442188
public function getAcceptableLanguages(?string $default = null): array
	{
		if(!isset($this->acceptableLanguages))
		{
			$this->acceptableLanguages = $this->parseAcceptHeader($this->get('accept-language'));
		}

		return $this->acceptableLanguages ?: (array) $default;
	}
863565
public static function get($key, $default = null, $locale = null)
    {
        return self::all($locale)->get($key, $default);
    }
900221
public static function setDefault()
    {
        if(!self::$default) {
            $languages = Language::all();
            if($languages) {
                $getDefault = $languages->where('isDefault', true);

                if ($getDefault) {
                    self::$default = $getDefault->first();
                    self::$current = self::$default; //current language is the same as default one in this phase

                    App::setLocale(self::$default->slug);
                    Carbon::setLocale(self::$default->slug);
                    return;
                }
            }

            throw new \Exception("Default language could not be found. Please check if a default language is defined in Administration");
        }
        return;
    }
681050
public function get($language = null, $default = null)
    {
        if ($language === null) {
            $language = 'default';
        }

        $data = parent::get($language, null);

        if ($data === null) {
            $data = $this->get('default', $default);
        }

        return $data;
    }
1249452
public function get( $key, $default = NULL )
	{
		if( $this->has( $key ) )
			return $this->pairs[( !$this->caseSensitive ? strtolower( $key ) : $key )];
		return $default;
	}
534920
public function getLanguage()
    {
        if ($this->sessionManager) {
            $this->sessionManager->start();
        }
        if (!isset($_SESSION['_fine_I18n_language'])){
            return null;
        }
        return $_SESSION['_fine_I18n_language'];
    }
426578
public static function method($default = 'GET')
	{
		// get the method from the current active request
		if ($request = \Request::active() and $method = $request->get_method())
		{
			return $method;
		}

		// if called before a request is active, fall back to the global server setting
		if (\Config::get('security.allow_x_headers', false))
		{
			return \Input::server('HTTP_X_HTTP_METHOD_OVERRIDE', \Input::server('REQUEST_METHOD', $default));
		}
		else
		{
			return \Input::server('REQUEST_METHOD', $default);
		}
	}
635365
public static function getTitle($default = '') {
        if (empty(self::$viewContext->title)) {
            if (isset(self::$viewContext->body) && !empty(self::$viewContext->body->title)) {
                return htmlspecialchars(self::$viewContext->body->title);
            }
            else {
                return htmlspecialchars($default);
            }
        }
        else
        {
            return htmlspecialchars(self::$viewContext->title);
        }
    }
1041707
public function getCustomerLang()
    {
        $lang = $this->getLangModel();

        if ($lang === null) {
            $lang = (new LangQuery)
                ->filterByByDefault(1)
                ->findOne()
            ;
        }

        return $lang;
    }
1314610
protected function getCurrentLang(){
        if(!Yii::$app->user->isGuest && !empty(Yii::$app->user->identity->lang)) {
            $lang = Yii::$app->user->identity->lang;
        } else if(Yii::$app->session->get('lang')) {
            $lang = Yii::$app->session->get('lang');
        } else {
            $lang = Yii::$app->getRequest()->getPreferredLanguage();
        }
        
        return $lang;
    }