Bug #103130
openLocalizationUtility does not load translations correctly if TypoScript overrides exist
0%
Description
Situation¶
We have an extension myext with 1 locallang.xlf
containing labels for default and DE.
- default: some value
- de: ein Wert
In addition some TypoScript is in place to override some DE labels like so:
plugin.tx_myext._LOCAL_LANG.de.someotherkey = etwas anderes
Using the LocalizationUtility in this order yields the default label albeit the German version has been requested:
- `LocalizationUtility::translate('somekey', 'myext')` => 'some value'
- `LocalizationUtility::translate('somekey', 'myext', 'de')` => 'some value'
The German value is completely omitted.
Reason¶
The utility first loads the xlf data for the requested language key. ("default" in case of our first line)
After that all existing TS overrides are added to the internal static array. ("someotherkey" in our case)
Calling it the second time above, then skips load of the xlf-data for the requested languageKey "de", due to the fact that data is already present because of the TS overrides processed in the first run.
Possible solution¶
Never store TS overrides in the internal array if the language is currently not requested.