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

Also available in: Atom PDF