Bug #66872
closedOnly output of default xml-labels in TYPO3 6.2.12
0%
Description
After update from Version 4.5.40 to 6.2.12 the substitiution of xml-labels does not work properly.
The problem occured after updating a website with multiple languages. In most languages everything works correctly, 3 languages cause problems.
In this 3 languages every output of xml is the default-labels instead of the labels defined for the certain language.This happens for Extensions like Formhandler or Freecap and for Typoscript like:
5 = TEXT
5.data = LLL:fileadmin/sprachdateien/allgemein.xml:aktuelles
Something like "lang.en = my Title" works.
All languages are defined the same way, for example:[globalVar = GP:L = 1]
config {
language = en
locale_all = en_GB
sys_language_uid = 1
htmlTag_setParams = lang="en"
}
[END]
RealUrl is installed. I tried to disable, but the problems persist.
Before update everything worked fine.
Files
Updated by Stephan Großberndt over 9 years ago
Verified using this setup:
config { linkVars = L language = de sys_language_uid = 0 htmlTag_setParams = lang="de" } [globalVar = GP:L=1] config { language = en sys_language_uid = 1 htmlTag_setParams = lang="en" } [global] page = PAGE page.10 = TEXT page.10.value = Hello World! page.20 = TEXT page.20.data = LLL:fileadmin/mytest.xml:test
with a website language english [sys_language_uid = 1] defined on root.
Calling "/index.php?id=1&L=1&no_cache=1" on TYPO3 4.5 results in "Hello World!English (UK)", on TYPO3 6.2: "Hello World!Deutsch"
The TYPO3 6.2 version contains "<html lang="en">", so the language handling is taken into account in general.
Updated by Ephraim Härer over 9 years ago
Did you try to use an xlf-file instead of an xml-file?
Updated by Stephan Großberndt over 9 years ago
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
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39512
Updated by Xavier Perseguers over 9 years ago
- Status changed from Under Review to Closed
closed as won't fix since patch has been abandoned.