/** * Sets the currently active language/language_alt keys. * Default values are "default" for language key and "" for language_alt key. * * @return void */ protected static function setLanguageKeys() { self::$languageKey = 'default'; self::$alternativeLanguageKeys = array(); if (TYPO3_MODE === 'FE') { if (isset($GLOBALS['TSFE']->config['config']['language'])) { self::$languageKey = $GLOBALS['TSFE']->config['config']['language']; if (isset($GLOBALS['TSFE']->config['config']['language_alt'])) { self::$alternativeLanguageKeys[] = $GLOBALS['TSFE']->config['config']['language_alt']; } else { /** @var $locales \TYPO3\CMS\Core\Localization\Locales */ $locales = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class); if (in_array(self::$languageKey, $locales->getLocales())) { foreach ($locales->getLocaleDependencies(self::$languageKey) as $language) { self::$alternativeLanguageKeys[] = $language; } } } } } elseif ($GLOBALS['BE_USER']->uc['lang'] !== '') { self::$languageKey = $GLOBALS['BE_USER']->uc['lang']; } }
/** * Sets the currently active language/language_alt keys. * Default values are "default" for language key and "" for language_alt key. * * @return void */ protected static function setLanguageKeys() { self::$languageKey = 'default'; self::$alternativeLanguageKeys = array(); if (TYPO3_MODE === 'FE') { if (isset(self::getTypoScriptFrontendController()->config['config']['language'])) { self::$languageKey = self::getTypoScriptFrontendController()->config['config']['language']; if (isset(self::getTypoScriptFrontendController()->config['config']['language_alt'])) { self::$alternativeLanguageKeys[] = self::getTypoScriptFrontendController()->config['config']['language_alt']; } else { /** @var $locales \TYPO3\CMS\Core\Localization\Locales */ $locales = GeneralUtility::makeInstance(Locales::class); if (in_array(self::$languageKey, $locales->getLocales())) { foreach ($locales->getLocaleDependencies(self::$languageKey) as $language) { self::$alternativeLanguageKeys[] = $language; } } } } } elseif (!empty($GLOBALS['BE_USER']->uc['lang'])) { self::$languageKey = $GLOBALS['BE_USER']->uc['lang']; } elseif (!empty(self::getLanguageService()->lang)) { self::$languageKey = self::getLanguageService()->lang; } }