Project

General

Profile

Actions

Bug #103130

open

LocalizationUtility does not load translations correctly if TypoScript overrides exist

Added by Markus Klein 3 months ago. Updated about 1 month ago.

Status:
Under Review
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 3 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 3 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 3 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 3 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 about 1 month ago

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

Updated by Gerrit Code Review about 1 month 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 about 1 month 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 about 1 month 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 about 1 month 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

Also available in: Atom PDF