Review main Merged

91994[TASK] Make use of proper formated XLIFF files more robust

Ayke Halder CR +2 V +2 Hard +300 −52 updated 01/19/26, 13:09

Commit message

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 feature
until now.

How to get on from here?

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

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 24

Show 4 more files

Review log 2645

Show 1120 earlier messages
  1. Ayke Halder uploaded patch set 1 12/03/25, 09:35

  2. core-ci voted on patch set 1 V -1 12/03/25, 09:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91510

  3. Ayke Halder uploaded patch set 2 V -1 12/03/25, 10:17

  4. Lina Wolf commented on patch set 2 12/03/25, 10:22

    What would happen if XLIFF 2.0 is used? Can you add a test for that as well?
  5. core-ci voted on patch set 2 V -1 12/03/25, 10:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91512

  6. Ayke Halder uploaded patch set 3 V -1 12/03/25, 11:55

  7. core-ci voted on patch set 3 V -1 12/03/25, 12:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91524

  8. Ayke Halder uploaded patch set 4 V -1 12/03/25, 15:09

  9. core-ci voted on patch set 4 V -1 12/03/25, 15:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91541

  10. Ayke Halder uploaded patch set 5 V -1 12/03/25, 18:15

  11. core-ci voted on patch set 5 V +1 12/03/25, 18:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91545

  12. Ayke Halder updated the commit message in patch set 6 V +1 12/03/25, 18:57

  13. Ayke Halder marked it ready for review 12/03/25, 18:57

  14. core-ci voted on patch set 6 V +1 12/03/25, 19:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91546

  15. Ayke Halder uploaded patch set 7 V +1 12/03/25, 20:28

  16. core-ci voted on patch set 7 V +1 12/03/25, 20:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91551

  17. Ayke Halder uploaded patch set 8 V +1 12/03/25, 20:40

  18. core-ci voted on patch set 8 V -1 12/03/25, 20:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91552

  19. Ayke Halder uploaded patch set 9 V -1 12/03/25, 21:24

  20. core-ci voted on patch set 9 V +1 12/03/25, 21:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91553

  1. Ayke Halder uploaded patch set 10 V +1 12/12/25, 14:21

  2. core-ci voted on patch set 10 V -1 12/12/25, 14:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92149

  3. Ayke Halder uploaded patch set 11 V -1 12/12/25, 14:31

  4. Ayke Halder uploaded patch set 12 12/12/25, 14:35

  5. core-ci voted on patch set 11 V -1 12/12/25, 14:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92151

  6. core-ci voted on patch set 12 V +1 12/12/25, 14:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92152

  7. Ayke Halder uploaded patch set 13 V +1 12/12/25, 15:34

  8. core-ci voted on patch set 13 V -1 12/12/25, 15:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92155

  9. Ayke Halder uploaded patch set 14 V -1 12/12/25, 16:32

  10. core-ci voted on patch set 14 V -1 12/12/25, 16:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92156

  11. Ayke Halder uploaded patch set 15 V -1 12/12/25, 17:10

  12. core-ci voted on patch set 15 V -1 12/12/25, 17:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92158

  13. Ayke Halder uploaded patch set 16 V -1 12/12/25, 17:56

  14. core-ci voted on patch set 16 V -1 12/12/25, 18:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92160

  15. Ayke Halder uploaded patch set 17 V -1 12/12/25, 18:16

  16. core-ci voted on patch set 17 V +1 12/12/25, 18:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92161

  17. Ayke Halder rebased onto patch set 18 V +1 12/22/25, 15:59

  18. core-ci voted on patch set 18 V +1 12/22/25, 16:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92585

  19. Benni Mack voted on patch set 18 CR +1 V +1 12/23/25, 07:01

  20. Josef Glatz updated the commit message in patch set 19 CR +1 V +1 12/28/25, 15:07

  21. core-ci voted on patch set 19 V +1 12/28/25, 15:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/92755

  22. Benni Mack voted on patch set 19 CR +1 V +1 12/28/25, 15:25

  23. Georg Ringer voted on patch set 19 CR +2 V +2 01/19/26, 13:09

  24. Georg Ringer merged patch set 20 01/19/26, 13:09