[TYPO3-english] Bug in locallangXMLOverride mechanism since TYPO3 4.6?

Lars Patrick Heß larshess at gmail.com
Thu Dec 15 16:22:26 CET 2011


Hi Dominique,

i had cleared the cache many times, the language cache too… When i replace the function t3lib_div::readLLfile with the old one from a 4.5 branch, everything works fine!

The new mechanism does sometimes not load the correct translations. In my opinion it happens when you are loading a language from a XML filere where nocht all possible langiage-keys are available in your target language. Now when a language-file is loaded by the locallangXMLOverride mechanism for merging with the original one, correct translations will be replaced with wrong loaded ones.


Am 15.12.2011 um 15:21 schrieb Dominique Feyer:

> Hi everybody,
> 
> During the review of the patch available on Gerrit, I think that it's
> not a bug ;) but a feature.
> 
> 4.6 introduce a caching mechanism for the l10n parser (based on the
> caching framework).
> 
> Lars, can you try this procedure:
> 
> Add this line in your localconf.php
> $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['cache']['clear_menu'] = TRUE;
> 
> Clear configuration cache and reload the backend, you now have a new
> item in the clear cache menu to clear the l10n cache.
> 
> After that reload your frontend.
> 
> Please do that on a vanilla 4.6 (without your patch).
> 
> Keep me in touche with the result.
> 
> Bests
> 
> Xavier Perseguers wrote:
>> Hi Lars,
>> 
>> Could you please do your review in Gerrit? You just have to log on
>> https://review.typo3.org/#change,7269, put your typo3.org credentials
>> and put your comments rights into the patch by double-clicking.
>> 
>> So you found a bug in your code? Because I basically took your code. No
>> problem of course :)
>> 
>> Xavier
>> 
>> Lars Patrick Heß wrote:
>>> Hi Xavier,
>>> 
>>> i had tested your code in a customer project and it does not work correctly, i had changed it to this:
>>> 
>>> 	protected function doParsingFromRootForElement(SimpleXMLElement $root, $element) {
>>> 		$bodyOfFileTag = $root->data->languageKey;
>>> 
>>> 			// Check if the source llxml file contains localized records
>>> 		$localizedBodyOfFileTag = $root->data->xpath("languageKey[@index='" . $this->languageKey . "']");
>>> 		if ($element === 'target' && count($localizedBodyOfFileTag) == 0) {
>>> 			return array();
>>> 		}
>>> 
>>> 		$parsedData = $this->getParsedDataForElement($bodyOfFileTag, $element);
>>> 		if ($element === 'target' && isset($localizedBodyOfFileTag[0]) && $localizedBodyOfFileTag[0] instanceof SimpleXMLElement) {
>>> 			$parsedDataTarget = $this->getParsedDataForElement($localizedBodyOfFileTag[0], $element);
>>> 			$mergedData = array_merge($parsedData, $parsedDataTarget);
>>> 
>>> 			if ($this->languageKey === 'default') {
>>> 				$parsedData = array_intersect_key($mergedData, $parsedData);
>>> 				$parsedData = array_intersect_key($mergedData, $parsedDataTarget);
>>> 			} else {
>>> 				$parsedData = array_intersect_key($mergedData, $parsedDataTarget);
>>> 			}
>>> 		}
>>> 
>>> 		return $parsedData;
>>> 	}
>>> 
>>> in my dev-environment it works very well, but not in the preview-system :(… later i will test it further...
>>> 
>>> 
>>> Am 15.12.2011 um 11:31 schrieb Xavier Perseguers:
>>> 
>>>> Hi Lars,
>>>> 
>>>>> I can imagine, that there is a better way then unset all unneeded keys…
>>>> Thanks for digging into this, I just reworked your patch to prevent a
>>>> manual loop over all keys and pushed it to Gerrit on behalf of yourself:
>>>> 
>>>> https://review.typo3.org/#change,7269
>>>> 
>>>> We have a short Skype meeting with Dominique in a few seconds for this
>>>> and other related L10n questions... :)
>>>> 
>>>> -- 
>>>> Xavier Perseguers
>>>> Release Manager TYPO3 4.6
>>>> 
>>>> TYPO3 .... inspiring people to share!
>>>> Get involved: http://typo3.org
>>>> 
>>>> _______________________________________________
>>>> TYPO3-english mailing list
>>>> TYPO3-english at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list