Review main Merged

94341[TASK] Extract form translation key chain building into dedicated class

Josua Vogel CR +2 V +2 Hard +677 −64 updated 06/09/26, 22:29

Commit message

Introduce FormTranslationKeyChainBuilder as a dedicated, injectable
service that encapsulates all translation key chain construction logic
for form elements, element options, validation errors and finisher
options.

Previously, TranslationService built these key chains inline via
scattered foreach/sprintf loops, duplicating the same specificity-first
ordering logic in multiple methods.

TranslationService is refactored to delegate all key chain construction
to FormTranslationKeyChainBuilder, which is injected via constructor.
Unit tests for the new class and updated functional tests for
TranslationService are added accordingly.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 1317

  1. Josua Vogel uploaded patch set 1 06/05/26, 15:52

  2. core-ci voted on patch set 1 V +1 06/05/26, 16:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/103043

  3. Oliver Klee voted on patch set 1 V +1 06/05/26, 20:22

  4. Oliver Klee commented on patch set 1 06/05/26, 20:31

    FormTranslationKeyChainBuilder.php:44

    Having a switch parameter for a different behavior tends to smell. Maybe we can have multiple, well-named methods and the shared code factored out. (Ditto for the other methods.)

    FormTranslationKeyChainBuilder.php:68

    All these `$translationFiles` parameters should get a PHPDoc type annotation `@param array<string> $translationFiles`.

    FormTranslationKeyChainBuilder.php:88

    Also, if I read this correctly, we have exactly the same code multiple times. We should move this to a central place instead of duplicating it.

    FormTranslationKeyChainBuilder.php:97

    All these methods should get a return annotation `@return list<string>`.

    FormTranslationKeyChainBuilder.php:137

    Nitpick: Can we make all these `!empty` checks more specific, i.e., either `is_string` or `!==`?
  5. Josua Vogel uploaded patch set 2 V +1 06/07/26, 15:51

  6. core-ci voted on patch set 2 V +1 06/07/26, 15:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/103085

  7. Josua Vogel commented on patch set 2 06/07/26, 16:04

    FormTranslationKeyChainBuilder.php:44 Reply

    Done

    FormTranslationKeyChainBuilder.php:68 Reply

    Done

    FormTranslationKeyChainBuilder.php:88 Reply

    Done

    FormTranslationKeyChainBuilder.php:97 Reply

    Done

    FormTranslationKeyChainBuilder.php:137 Reply

    Done
  8. Oliver Klee voted on patch set 2 V +1 06/07/26, 21:00

  9. Josua Vogel updated the commit message in patch set 3 V +1 06/08/26, 06:06

  10. core-ci voted on patch set 3 V +1 06/08/26, 06:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/103109

  11. Oliver Klee commented on patch set 3 CR +1 V +1 06/09/26, 14:16

    Beautiful!
  12. Christian Kuhn uploaded patch set 4 CR +1 V +1 06/09/26, 21:45

  13. Christian Kuhn commented on patch set 4 CR +1 V +1 06/09/26, 21:45

    filling a test gap and minor test adaptions, only.
  14. core-ci voted on patch set 4 V +1 06/09/26, 21:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/103248

  15. Oliver Klee voted on patch set 4 CR +1 V +1 06/09/26, 22:13

  16. Christian Kuhn voted on patch set 4 CR +2 V +2 06/09/26, 22:29

  17. Christian Kuhn merged patch set 5 06/09/26, 22:29