Project

General

Profile

Actions

Bug #103130

open

LocalizationUtility does not load translations correctly if TypoScript overrides exist

Added by Markus Klein 9 months ago. Updated 21 days ago.

Status:
Needs Feedback
Priority:
Must have
Assignee:
Category:
Localization
Target version:
-
Start date:
2024-02-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Situation

We have an extension myext with 1 locallang.xlf containing labels for default and DE.

locallang.xlf for id "somekey":
  • 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.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #103505: Overriding locallang labels from TypoScript does not work as expectedNew2024-03-29

Actions
Actions #1

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.

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

Updated by Markus Klein 8 months ago

  • Related to Bug #103505: Overriding locallang labels from TypoScript does not work as expected added
Actions #6

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

Actions #7

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

Actions #8

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.

Actions #9

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

Actions #10

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?

Actions #11

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.

Actions

Also available in: Atom PDF