In TYPO3 4.5 this code is used: typo3\sysext\cms\tslib\class.tslib_fe.php
function readLLfile($fileRef) {
return t3lib_div::readLLfile($fileRef, $this->lang, $this->renderCharset);
}
Here
$this->lang
is passed as a parameter ("en" in our case) and all is well.
In TYPO3 6.2 this code is used: typo3\sysext\frontend\Classes\Controller\TypoScriptFrontendController.php
/**
* Read locallang files - for frontend applications
*
* @param string $fileRef Reference to a relative filename to include.
* @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
* @todo Define visibility
*/
public function readLLfile($fileRef) {
if ($this->lang !== 'default') {
$languages = array_reverse($this->languageDependencies);
// At least we need to have English
if (empty($languages)) {
$languages[] = 'default';
}
} else {
$languages = array('default');
}
$localLanguage = array();
foreach ($languages as $language) {
$tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->renderCharset);
$localLanguage['default'] = $tempLL['default'];
if (!isset($localLanguage[$this->lang])) {
$localLanguage[$this->lang] = $localLanguage['default'];
}
if ($this->lang !== 'default' && isset($tempLL[$language])) {
// Merge current language labels onto labels from previous language
// This way we have a label with fall back applied
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($localLanguage[$this->lang], $tempLL[$language], TRUE, FALSE);
}
}
return $localLanguage;
}
$this->languageDependencies
is initialized by calling initLLvars()
.
// Finding the requested language in this list based
// on the $lang key being inputted to this function.
/** @var $locales \TYPO3\CMS\Core\Localization\Locales */
$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;
}
}
Here is the reason: Only if $this->lang
is found to be a valid entry in $locales->getLocales()
it is used.
This means: On TYPO3 6.2 you can ONLY use keys in locallang files which have been defined in typo3\sysext\core\Classes\Localization\Locales.php:$languages