Hi Lars, Do you mind posting this as a bug on http://forge.typo3.org/projects/typo3v4-core/issues and push the suggested fix to our review server?
Kind regards Markus > -----Original Message----- > From: typo3-english-boun...@lists.typo3.org > [mailto:typo3-english-boun...@lists.typo3.org] On Behalf Of Lars Patrick Heß > Sent: Wednesday, December 14, 2011 1:11 PM > To: TYPO3 English > Subject: Re: [TYPO3-english] Bug in locallangXMLOverride mechanism since > TYPO3 4.6? > > After some debugging the question came to my mind, why the parser for XML > files always returned all available translation for the > "default" language when it is not available inside the default-node? > > So i change code inside the method > "t3lib_l10n_parser_Llxml::doParsingFromRootForElement": > > protected function doParsingFromRootForElement(SimpleXMLElement $root, > $element) { > $bodyOfFileTag = $root->data->languageKey; > > $parsedData = $this->getParsedDataForElement($bodyOfFileTag, > $element); > > if ($element === 'source') > return $parsedData; > > // Check if the source llxml file contains localized > records > $localizedBodyOfFileTag = > $root->data->xpath("languageKey[@index='" . $this->languageKey . "']"); > if ($element === 'target' && isset($localizedBodyOfFileTag[0]) > && $localizedBodyOfFileTag[0] instanceof > SimpleXMLElement) { > $parsedTargetData = > $this->getParsedDataForElement($localizedBodyOfFileTag[0], $element); > $mergedData = array_merge($parsedData, > $parsedTargetData); > > if ($this->languageKey === 'default') { > foreach (array_keys($mergedData) as $key) { > if (!isset($parsedData[$key])) > unset($mergedData[$key]); > } > foreach (array_keys($mergedData) as $key) { > if (!isset($parsedTargetData[$key])) > unset($mergedData[$key]); > } > } > > return $mergedData; > } > > return $parsedData; > } > > > No my testcase runs very well! > This code will never return default-language translations if they are not > available! > > Also this cases do pass (originalTranslationFile.xml is always the same): > > otherTranslationFile V2: > <?xml version="1.0" encoding="utf-8" standalone="yes" ?> > <T3locallang> > <data type="array"> > <languageKey index="default" type="array"> > <label index="test_label_one">one (default > NEW)</label> > <label index="test_label_two">two (default > NEW)</label> > </languageKey> > > <languageKey index="de" type="array"> > <label index="test_label_one">eins (german > NEW)</label> > </languageKey> > > <languageKey index="fr" type="array"> > <label index="test_label_one">une > (française)</label> > </languageKey> > </data> > </T3locallang> > > > otherTranslationFile V3: > <?xml version="1.0" encoding="utf-8" standalone="yes" ?> > <T3locallang> > <data type="array"> > <languageKey index="default" type="array"> > <label index="test_label_two">two (default > NEW)</label> > </languageKey> > > <languageKey index="de" type="array"> > <label index="test_label_one">eins (german > NEW)</label> > </languageKey> > > <languageKey index="fr" type="array"> > <label index="test_label_one">une > (française)</label> > </languageKey> > </data> > </T3locallang> > > > > > > Am 13.12.2011 um 17:52 schrieb Lars Patrick Heß: > > > Hey all :-) > > > > i am using the "locallangXMLOverride" in TYPO3 4.6 mechanism to override > > XML-languagefiles, i use the following line oh php code > to configure the override in a localconf-file: > > > > > > $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['path/to/originalTranslationFile.xml'][] > > = > 'path/to/otherTranslationFile.xml' > > > > The content of the original translation file "originalTranslationFile.xml" > > is this: > > > > <?xml version="1.0" encoding="utf-8" standalone="yes" ?> > > <T3locallang> > > <data type="array"> > > <languageKey index="default" type="array"> > > <label index="test_label_one">one > > (default)</label> > > <label index="test_label_two">two > > (default)</label> > > </languageKey> > > > > <languageKey index="de" type="array"> > > <label index="test_label_one">eins > > (german)</label> > > <label index="test_label_two">zwei > > (german)</label> > > </languageKey> > > </data> > > </T3locallang> > > > > > > The content of the translation file "otherTranslationFile.xml", which is > > used to override translations, is this: > > > > <?xml version="1.0" encoding="utf-8" standalone="yes" ?> > > <T3locallang> > > <data type="array"> > > <languageKey index="fr" type="array"> > > <label index="test_label_one">une > > (française)</label> > > </languageKey> > > </data> > > </T3locallang> > > > > > > My testcase in typoscriot is something like this, it only outputs two > > translations via the TS-TEXT object: > > config { > > linkVars = L > > sys_language_uid = 0 > > language = en > > locale_all = en_EN.UTF-8 > > htmlTag_langKey = en > > } > > > > # DE > > [globalVar=GP:L=1] > > config { > > sys_language_uid = 1 > > language = de > > locale_all = de_DE.UTF-8 > > htmlTag_langKey = de > > } > > [global] > > > > # FR > > [globalVar = GP:L = 2] > > config { > > sys_language_uid = 2 > > language = fr > > locale_all = fr_FR.UTF-8 > > htmlTag_langKey = fr > > } > > [global] > > > > page = PAGE > > page.typeNum = 0 > > > > page.10 = TEXT > > page.10.data = LLL:path/to/originalTranslationFile.xml:test_label_one > > page.10.wrap = | <br /> > > > > page.20 = TEXT > > page.20.data = LLL:path/to/originalTranslationFile.xml:test_label_two > > > > > > The output in english (the default language) is this: > > une (française) // << that's wrong! It must be "one (default)" > > two (default) > > > > In german: > > une (française) // << that's wrong! It must be "eins (german)" > > zwei (german) > > > > In french: > > une (française) > > two (default) > > > > > > The error occured while processing the locallangXMLOverrides-files, while > > loading the language "default" from the translation file > "otherTranslationFile.xml" (which does not contain any default-translations), > the french-translations are rreturned! So the default > translations from the "originalTranslationFile.xml" translation file will be > overridden while the merging process! > > When i replace the t3lib_div::readLLfile method with the code from TYPO3 > > 4.5 (so that the new t3lib_l10n classes are not used) it > works! > > > > Does anyone knows the problem? > > > > Thanks, > > Lars > > _______________________________________________ > > TYPO3-english mailing list > > TYPO3-english@lists.typo3.org > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english > > _______________________________________________ > TYPO3-english mailing list > TYPO3-english@lists.typo3.org > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english _______________________________________________ TYPO3-english mailing list TYPO3-english@lists.typo3.org http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english