Review main Merged

92468[FEATURE] Support ICU MessageFormat for translations

Benni Mack CR +2 V +2 Hard +419 −10 updated 02/23/26, 19:23

Commit message

TYPO3 now supports ICU MessageFormat for translations, enabling
proper handling of plural forms, gender-based selections, and
other locale-aware formatting directly in language labels.

The format is automatically detected based on argument types:
- Named arguments (associative array): Uses ICU MessageFormat
- Positional arguments (indexed array): Uses sprintf (unchanged)

Example XLIFF:
- <source>{count, plural, one {# file} other {# files}}</source>

Example PHP:
- $languageService->translate('file_count', 'domain', ['count' => 5]);

Example Fluid:
- <f:translate key="file_count" arguments="{count: files}" />

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Garvin Hicking +1
    • Anja Leichsenring +1
    • Sven Liebert +1
  • Verified V +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Garvin Hicking +1
    • Anja Leichsenring +1
    • Sven Liebert +1
    • core-ci +1 CI

Issues 1

Files 8

Review log 2026

Show 1 earlier messages
  1. Benni Mack uploaded patch set 1 01/22/26, 19:57

  1. Benni Mack marked it work in progress 01/22/26, 19:57

  2. core-ci voted on patch set 1 V -1 01/22/26, 20:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94093

  3. Garvin Hicking uploaded patch set 2 V -1 01/23/26, 10:32

    fix test fixture xliff
  4. core-ci voted on patch set 2 V +1 01/23/26, 10:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94147

  5. Benni Mack marked it ready for review 01/23/26, 21:11

  6. Garvin Hicking commented on patch set 2 01/24/26, 11:24

    LanguageService.php:285

    check out https://www.php.net/array_is_list to cut this significantly :)

    LanguageService.php:296

    gut feeling is the regexp might be too broad since the latter keys are optional? Wonder if is needed at all because this happens when we have named arguments but no formatting - what happens with the arguments in the vsprintf() fallback then, likely an error? So we might also maie that throw an exception because you use arguments on an ICU expection where there is none?
  7. Benni Mack uploaded patch set 3 V +1 01/24/26, 12:33

  8. core-ci voted on patch set 3 V +1 01/24/26, 12:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94252

  9. Xavier Perseguers commented on patch set 3 02/11/26, 09:37

    Thinking about it, I must admit I like the idea of something well-tested and easy to implement thanks to some PHP library. Minor changes in French :)

    fr.locallang_icu.xlf:23

    Téléchargé (with accents)

    fr.locallang_icu.xlf:27

    "Iel" would be the generic form, "Ils" is the 3rd plural form. "a aimé" (with an accent)
  10. Benjamin Franzke commented on patch set 3 02/20/26, 14:00

    FYI: I work on the JavaScript counterpart/implementation in: > 92925: [WIP][TASK] Support ICU messages in JavaScript label API | https://review.typo3.org/c/Packages/TYPO3.CMS/+/92925
  11. Benjamin Franzke uploaded patch set 4 V +1 02/23/26, 12:08

  12. Benjamin Franzke commented on patch set 4 02/23/26, 12:08

    Reply

    Done

    LanguageService.php:285 Reply

    Done

    LanguageService.php:296 Reply

    I removed the regex to purely decide based on named parameter submission.

    fr.locallang_icu.xlf:23 Reply

    it is just a fixture, but adapted, thx!

    fr.locallang_icu.xlf:27 Reply

    Done
  13. Benjamin Franzke uploaded patch set 5 CR +1 V +1 02/23/26, 12:32

  14. core-ci voted on patch set 4 V -1 02/23/26, 12:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96567

  15. core-ci voted on patch set 5 V +1 02/23/26, 13:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96572

  16. Benjamin Franzke voted on patch set 5 CR +1 V +1 02/23/26, 13:56

  17. Garvin Hicking commented on patch set 5 CR +1 V +1 02/23/26, 14:48

    Works for me, only one minor comment, but I can also live with the current implementation (maybe it's "safer" to use a regexp, because as the inline f:translate demo shows there might have been misuses implemented?!

    LanguageService.php:296 Reply

    @ben@bnf.dev In the TranslateViewHelper.php file the regexp still exists. I would tend to also use array_is_list there, what do you think?
  18. Benjamin Franzke uploaded patch set 6 CR +1 V +1 02/23/26, 15:14

  19. Benjamin Franzke commented on patch set 6 CR +1 V +1 02/23/26, 15:14

    LanguageService.php:296 Reply

    Ack, we should adapt that as well! Thx & done!
  20. Garvin Hicking voted on patch set 6 CR +1 V +1 02/23/26, 15:27

  21. core-ci voted on patch set 6 V +1 02/23/26, 15:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96593

  22. Sven Liebert voted on patch set 6 CR +1 V +1 02/23/26, 17:50

  23. Anja Leichsenring voted on patch set 6 CR +1 V +1 02/23/26, 17:55

  24. Benni Mack commented on patch set 6 CR +2 V +2 02/23/26, 19:23

    thank you!
  25. Benni Mack merged patch set 7 02/23/26, 19:23