#53973Cannot add user defined locales to be used with "sL(...)"
Description
TYPO3 has a list of “known” languages set in TYPO3\CMS\Core\Localization\Locales.
To extend this list one can use something like this:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']['id'] = 'Indonesian';
For reading the translation of a word in this language, one can use:
$GLOBALS['TSFE']->sL('LLL:path/to/lang/file/lang.xml:langkey');
Problem
The user defined locales are not taken into account.
In TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController (line 4675):
$locales = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
// Language is found. Configure it:
if (in_array($this->lang, $locales->getLocales())) {
$this->languageDependencies[] = $this->lang;
foreach ($locales->getLocaleDependencies($this->lang) as $language) {
$this->languageDependencies[] = $language;
}
}
There is no call to $locales->initialize() which would read the user defined settings:
$locales = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
$locales->initialize();
// Language is found. Configure it:
if (in_array($this->lang, $locales->getLocales())) {
$this->languageDependencies[] = $this->lang;
foreach ($locales->getLocaleDependencies($this->lang) as $language) {
$this->languageDependencies[] = $language;
}
}