Review main Merged

93435[FEATURE] Introduce PSR-14 `ModifyLocalizationHandlerIsAvailableEvent`

Stefan Bürk CR +2 V +2 Hard +276 −3 updated 03/30/26, 20:31

Commit message

With #108049 the localization handling has been modernized
and intruced handler based logic while restricting possible
modes (copy & localize).

The effort put into it pays of and can be used for
real-world implementation within extensions and
leaves nearly nothing open, except that for some
context and cases some of the handlers should be
removed even if the handler itself states they are
available.

Instead of implementing an event for the single handler
provided by TYPO3 itself, it's more convenient to have
that available in a place to do that for all possible
registered handlers.

This change introduces and dispatches the new PSR-14
`ModifyLocalizationHandlerIsAvailableEvent` in method
`LocalizationHandlerRegistry::getAvailableHandlers()`
to allow instances and extensions to overrule available
state for a handler based on the `LocalizationInstructions`.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Guido Schmechel +1
    • Josua Vogel +1
    • Oliver Hader +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Guido Schmechel +1
    • Josua Vogel +1
    • Oliver Hader +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 2

Files 4

Review log 2228

Show 23 earlier messages
  1. Stefan Bürk uploaded patch set 1 03/30/26, 17:09

  2. Stefan Bürk uploaded patch set 2 03/30/26, 17:11

  3. core-ci voted on patch set 2 V -1 03/30/26, 17:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99099

  1. Garvin Hicking commented on patch set 2 03/30/26, 17:31

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:14

    ```suggestion The PSR-14 event :php-short:`\TYPO3\CMS\Backend\Localization\Event\ModifyLocalizationHandlerIsAvailableEvent` ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:15

    ```suggestion is introduced and fired in :php-short:`\TYPO3\CMS\Backend\Localization\LocalizationHandlerRegistry` ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:17

    This changelog is very technical and people might not understand what "Localization" refers to. I myself first thought it's about the XLIFF localization/translation interface, not the "translation wizard". Can you add one sentence like "This affects the localization wizard when translating pages or records in the TYPO3 backend."?

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:17

    ```suggestion on the :php-short:`\TYPO3\CMS\Backend\Localization\LocalizationInstructions\LocalizationInstructions`. ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:19

    ```suggestion The event provides the following properties: ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:24

    ```suggestion a handler has been xclass'd without changing the identifier. ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:26

    ```suggestion instruction passed to the handler's `isAvailable()` method to define the context. ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:27

    ```suggestion * :php:`public bool $isAvailable`: The returned availibility state of the handler, ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:28

    ```suggestion which can be altered by a PSR-14 Event listener. ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:54

    ```suggestion // Return early if not ManualLocalizationHandler ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:62

    ```suggestion if ($event->instructions->mode !== LocalizationMode::TRANSLATE) { ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:79

    ```suggestion Custom extensions (public or project-specific) are ```

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:80

    ```suggestion now able to intercept, which handlers are available for offering localization steps in the translation wizard, based on the provided ```
  2. core-ci voted on patch set 1 V -1 03/30/26, 17:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99098

  3. Stefan Bürk uploaded patch set 3 V -1 03/30/26, 18:57

  4. Stefan Bürk uploaded patch set 4 03/30/26, 18:59

  5. Stefan Bürk commented on patch set 4 03/30/26, 18:59

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:14 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:15 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:17 Reply

    Added something. Hope it's okay now for you.

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:17 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:19 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:24 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:26 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:27 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:28 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:54 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:62 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:79 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:80 Reply

    Done
  6. Garvin Hicking commented on patch set 4 03/30/26, 19:02

    ```suggestion This change introduces and dispatches the new PSR-14 ```
    ```suggestion allow instances and extensions to overrule available state ```
    ```suggestion for a handler based on the `LocalizationInstructions`. ```
  7. core-ci voted on patch set 4 V +1 03/30/26, 19:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99106

  8. Stefan Bürk commented on patch set 4 03/30/26, 19:11

    Reply

    Done

    Reply

    Done

    Reply

    Done
  9. Stefan Bürk uploaded patch set 5 V +1 03/30/26, 19:12

  10. Stefan Bürk commented on patch set 5 03/30/26, 19:12

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:17 Reply

    Done
  11. Garvin Hicking voted on patch set 5 CR +1 V +1 03/30/26, 19:18

  12. Josua Vogel voted on patch set 5 CR +1 V +1 03/30/26, 19:22

  13. Simon Schaufelberger commented on patch set 5 03/30/26, 19:25

    convenient

    LocalizationHandlerRegistryTest.php:35

    can be private

    LocalizationHandlerRegistryTest.php:109

    remove empty line

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:18

    use `:php:`
  14. core-ci voted on patch set 5 V +1 03/30/26, 19:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99107

  15. core-ci voted on patch set 3 V +1 03/30/26, 19:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99105

  16. Stefan Bürk commented on patch set 5 03/30/26, 19:38

    Reply

    Done

    LocalizationHandlerRegistryTest.php:35 Reply

    Done

    LocalizationHandlerRegistryTest.php:109 Reply

    Done

    Feature-109429-IntroducePSR-14ModifyLocalizationHandlerIsAvailableEvent.rst:18 Reply

    See comment from @garvin with edit suggest. Keeping it now as is, this can be battled after 14.2 feature freaze in a doc change. Stopping a back and forth here now. Sorry.
  17. Stefan Bürk uploaded patch set 6 CR +1 V +1 03/30/26, 19:39

  18. Josua Vogel voted on patch set 6 CR +1 V +1 03/30/26, 19:40

  19. Simon Schaufelberger voted on patch set 6 CR +1 V +1 03/30/26, 19:42

  20. core-ci voted on patch set 6 V +1 03/30/26, 19:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99110

  21. Garvin Hicking voted on patch set 6 CR +1 V +1 03/30/26, 20:10

  22. Oliver Hader voted on patch set 6 CR +1 V +1 03/30/26, 20:25

  23. Guido Schmechel voted on patch set 6 CR +1 V +1 03/30/26, 20:29

  24. Stefan Bürk voted on patch set 6 CR +2 V +2 03/30/26, 20:31

  25. Stefan Bürk merged patch set 7 03/30/26, 20:31