Fetches the base language used to copy the entities

@return \RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Model\Language
320034
protected function getBaseLanguage()
    {
        $languageRepository = $this->languageManager->getLanguageRepository();

        // Tries to fetch the current language from the request
        if (null !== $this->request) {
            $languages = $this->request->getLanguages();

            $alLanguage = $languageRepository->fromLanguageName($languages[1]);
            if (null !== $alLanguage) {
                return $alLanguage;
            }
        // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        // Fetches the current language from the main language when the adding one is not the main language
        if ($this->mainLanguage->getId() != $this->languageManager->get()->getId()) {
            return $this->mainLanguage;
        }

        return $languageRepository->firstOne();
    }
629079
public function getTranslations()
    {
        return $this->owner->hasMany($this->translationClassName, [$this->languageForeignKey => $this->_ownerPrimaryKey]);
    }
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;
    }
155725
public function getLanguageList() {
		$files = glob($this->getPath().'messages_*.php');
		
		$startAt = strlen('messages_');
		$languages = array();
		foreach ($files as $file) {
			$base = basename($file);
			$languages[] = substr($base, $startAt, strrpos($base, '.php') - $startAt);
		}
		return $languages;
	}
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;
    }
1368297
public function getLanguageCode() {

		if (!$this->issetCache('lang')) {
	
			$query =
				'SELECT l.code' .
				' FROM `languages` AS l' .
				' INNER JOIN `locales` AS lc ON l.id = lc.language_id' .
				' INNER JOIN `users` AS u ON u.locale_id = lc.id' .
				' WHERE u.id = ?';
			$this->db->setQuery($query);
			$this->setCache('lang', $this->db->loadResult($this->id));

		}
	
		return $this->getCache('lang');

	}
46770
public function getSiteLanguage()
    {
        if (is_null($this->language) && ($request = $this->requestStack->getMasterRequest())) {
            $this->language = $request->get('language', $request->getLocale());
        }

        return $this->language;
    }
91610
public function getRespondentLanguage()
    {
        if (! isset($this->_respTrackData['grs_iso_lang'])) {
            $this->_ensureRespondentData();

            if (! isset($this->_respTrackData['grs_iso_lang'])) {
                // Still not set in a project? The it is single language
                $this->_respTrackData['grs_iso_lang'] = $this->locale->getLanguage();
            }
        }

        return $this->_respTrackData['grs_iso_lang'];
    }
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;
    }
1107728
public function getBaseLanguage()
    {
        if ($this->_iBaseLanguageId === null) {
            $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $blAdmin = $this->isAdmin();

            // languages and search engines
            if ($blAdmin && (($iSeLang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('changelang')) !== null)) {
                $this->_iBaseLanguageId = $iSeLang;
            }

            if (is_null($this->_iBaseLanguageId)) {
                $this->_iBaseLanguageId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('lang');
            }

            //or determining by domain
            $aLanguageUrls = $myConfig->getConfigParam('aLanguageURLs');

            if (!$blAdmin && is_array($aLanguageUrls)) {
                foreach ($aLanguageUrls as $iId => $sUrl) {
                    if ($sUrl && $myConfig->isCurrentUrl($sUrl)) {
                        $this->_iBaseLanguageId = $iId;
                        break;
                    }
                }
            }

            if (is_null($this->_iBaseLanguageId)) {
                $this->_iBaseLanguageId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('language');
                if (!isset($this->_iBaseLanguageId)) {
                    $this->_iBaseLanguageId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('language');
                }
            }

            // if language still not set and not search engine browsing,
            // getting language from browser
            if (is_null($this->_iBaseLanguageId) && !$blAdmin && !\OxidEsales\Eshop\Core\Registry::getUtils()->isSearchEngine()) {
                // getting from cookie
                $this->_iBaseLanguageId = \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie('language');

                // getting from browser
                if (is_null($this->_iBaseLanguageId)) {
                    $this->_iBaseLanguageId = $this->detectLanguageByBrowser();
                }
            }

            if (is_null($this->_iBaseLanguageId)) {
                $this->_iBaseLanguageId = $myConfig->getConfigParam('sDefaultLang');
            }

            $this->_iBaseLanguageId = (int) $this->_iBaseLanguageId;

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

            \OxidEsales\Eshop\Core\Registry::getUtilsServer()->setOxCookie('language', $this->_iBaseLanguageId);
        }

        return $this->_iBaseLanguageId;
    }
439245
public function getLanguage()
    {
        if ($this->_oLanguageObject === null) {
            $this->_oLanguageObject = oxRegistry::getLang();
        }

        return $this->_oLanguageObject;
    }
1041707
public function getCustomerLang()
    {
        $lang = $this->getLangModel();

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

        return $lang;
    }
1220210
public function translation()
    {
        if (is_null($this->translationsClass))
            $this->translationsClass = get_class($this) . 'Translations';

        return $this->hasOne($this->translationsClass, 'record_id', 'id')->where('language_code', app()->getLocale());
    }
1371555
public function getTplLanguage()
    {
        if ($this->_iTplLanguageId === null) {
            $iSessLang = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('tpllanguage');
            $this->_iTplLanguageId = $this->isAdmin() ? $this->setTplLanguage($iSessLang) : $this->getBaseLanguage();
        }

        return $this->_iTplLanguageId;
    }
93734
public function language()
    {
        $required = null;

        // Get the minimum version of the application
        if ($this->getManager() && $manifest = $this->getManager()->getManifestContents()) {
            $required = $this->getLanguageConstraint($manifest);
        }

        // Cancel if no version constraint
        if (!$required) {
            return true;
        }

        $version = $this->getCurrentVersion();
        $hasRequiredVersion = version_compare($version, $required, '>=');
        if (!$hasRequiredVersion) {
            $this->explainer->error(sprintf('%s is not at required version: %s instead of %s', $this->getLanguage(), $version, $required));
        }

        return $hasRequiredVersion;
    }
542133
public function getLanguage()
    {
        if ($this->_language === null) {
            $this->_language = strtolower(Yii::$app->language);
        }
        return $this->_language;
    }
534920
public function getLanguage()
    {
        if ($this->sessionManager) {
            $this->sessionManager->start();
        }
        if (!isset($_SESSION['_fine_I18n_language'])){
            return null;
        }
        return $_SESSION['_fine_I18n_language'];
    }