Review main Abandoned

92121[Proof of concept] Test cases for more robust XLIFF file handling

Ayke Halder CR 0 V -1 Hard +255 −19 updated 01/19/26, 17:12

Commit message

These are just the test cases.

----

If an XLIFF file is a translation, then `target` items must be used.
If an XLIFF file is a translation base e.g. 'en', then `source` items
must be used.

This decision is only dependant on the file itself and is not dependant
on the 'locale' context in which a file is loaded.

E.g. in Localization 'en' files might be added to a non-english locale.
Then Symfony Translator calls XliffLoader with locale like 'ru' and an
english XLIFF file.

With this change XLIFF files which have a target language attribute

* `target-language` (XLIFF 1.2)
* `trgLang`(XLIFF 2.0)

are handled as localized file and all values are extracted from
`target` tags.
XLIFF files which do not have a target language attribute are
handled as original file and all values are extracted from
`source` tags.
There are no fallbacks in place.

It was a feature - and became a bug!

On all these changes which are not directly related to `XliffLoader`:
The implementation was buggy until now. Every language file had its
english version as fallback added.

Example for locale 'fr-FR':

* fr-FR -> en
* fr -> en
* en -> en

As a result if there was no language file 'fr-FR' all labels used
fallback 'en'.
Instead they should first fallback to 'fr' - and use 'en' as final
fallback only:

* fr-FR -> fr -> en

So why was this behaviour not buggy until now?

For all files loaded in the context of non 'en' locales, the
`XliffLoader` implemented strict usage of `target` items only, ignoring
all `source` items.

1. There is no 'fr-FR' file.
2. The 'en' file is loaded as fallback.
3. `XliffLoader` extracts all `target` items from 'en' files. As there
   are only `source` items in 'en' files this results in no items
   found, so every item is still `null`.
4. The 'fr' file is loaded as fallback and all `target` items are
   applied.
5. The 'en' file is loaded (this time in 'en' locale context) and all
   `source` items are applied as fallback.

So not having any `target` items in 'en' files was used as feauture
until now.

How to get on from here?

The localization fallback and override should be based on
Symfony Translator `fallbackCatalogue`.

Review

  • Code review CR 0
  • Verified V -1
    • core-ci -1 CI

Files 20

Review log 23

  1. Ayke Halder uploaded patch set 1 12/12/25, 18:20

  2. core-ci voted on patch set 1 V -1 12/12/25, 18:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92162

  3. Ayke Halder abandoned the change 01/19/26, 17:12

    as merged with 91994: [TASK] Make use of proper formated XLIFF files more robust | https://review.typo3.org/c/Packages/TYPO3.CMS/+/91994