Issue Bug Closed

#20219LOCAL_LANG default values are overwritten by localized text

Mathias Gisch 03/20/09, 13:49 updated 07/02/10, 11:18

Description

Consider the following XML (see XML-file attached):

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<t3locallang><br> <meta type="array"><br> <type>module</type><br> <description>Language labels for testing purposes</description><br> <br> <data type="array"><br> <languagekey index="default" type="array"><br> <label index="button1">Button 1 – Description (EN)</label><br> <label index="button2">Button 2 – Description (EN)</label><br> <label index="button3">Button 3 – Description (EN)</label><br> </languagekey><br> <languagekey index="fr" type="array"><br> <label index="button1">Button 1 – Description (FR)</label><br> <label index="button2">Button 2 – Description (FR)</label><br> </languagekey><br> </data><br></t3locallang>

When tring to get the french Label for Button 3, you expect to receive “Button 3 – Description (EN)”, since there is no french localized label for Button 3.
Instead you get “Button 2 – Description (FR)”.
The last default value, is always replaced by the last localized value (see Screenshot).

This is caused by the readLLXMLfile-function. The function iterates through the $LOCAL_LANG[‘default’] values by assigning by reference to $labelValue (line 4186).
Since $labelValue is not unset later, the reference will stay on the last value of $LOCAL_LANG[‘default’]. Later then $labelValue is used again to iterate through $LOCAL_LANG[$langKey], and it then overwrites the last value in $LOCAL_LANG[‘default’] since the reference is still intact.
(issue imported from #M10742)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.