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.
Updated by Markus Klein 9 months ago
It is yet to be determined if v12+ is affected as well. The code-base has changed a lot there.
Updated by Gerrit Code Review 9 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Gerrit Code Review 9 months ago
Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Gerrit Code Review 9 months ago
Patch set 3 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Markus Klein 8 months ago
- Related to Bug #103505: Overriding locallang labels from TypoScript does not work as expected added
Updated by Gerrit Code Review 8 months ago
Patch set 4 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Gerrit Code Review 8 months ago
Patch set 5 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Markus Klein 8 months ago
Markus Klein wrote in #note-1:
It is yet to be determined if v12+ is affected as well. The code-base has changed a lot there.
v12+ has its own problems. See related tickets.
The patch applies only for v11.
Updated by Gerrit Code Review 8 months ago
Patch set 6 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83013
Updated by Benni Mack 21 days ago
- Status changed from Under Review to Closed
Closing this issue, as this is a v11 issue (where free support ends today). @markus can you check if this one https://forge.typo3.org/issues/103505 still exists in v12?
Updated by Markus Klein 21 days ago
- Status changed from Closed to Needs Feedback
I didn't check this on v12 yet. So this issue can still be a v12 thingy too.
Putting it into needs-feedback, so I don't forget about it.