Review main Merged

78325[BUGFIX] Ensure translate ViewHelper uses site language locale

Benni Mack CR +2 V +2 Easy +6 −8 updated 04/04/23, 13:39

Commit message

When using the `<f:translate>` ViewHelper out of Extbase
context (e.g., in `FLUIDTEMPLATE` or `StandaloneView`),
TYPO3 v12 checked for `$GLOBALS[LANG]`, which is wrong,
as this is the language of a backend editor - all
labels (outside of Extbase) were then rendered
with the editors view.

This is of course an ugly bug, which happened due to
https://review.typo3.org/c/Packages/TYPO3.CMS/+/75941

For this reason, `<f:translate>` does not check
for `$GLOBALS[LANG]` anymore, but instead checks for the
`SiteLanguage` first, and then checks for the
`$GLOBALS[BE_USER]`.

In addition, as long as we have a static list
of dependencies, the locale object needs to be
instantiated from the `Locales` class in order
to resolve the defined dependencies. This could
probably vanish once all information is put into
the right places.

Review

  • Code review CR +2 Done
    • Kevin Appelt +2
    • Marc Willmann +1
  • Verified V +2 Done
    • Kevin Appelt +2
    • Marc Willmann +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 1117

  1. Benni Mack uploaded patch set 1 03/29/23, 15:05

  2. Benni Mack updated the commit message in patch set 2 03/29/23, 15:15

  3. core-ci voted on patch set 1 V -1 03/29/23, 15:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39832

  4. core-ci voted on patch set 2 V -1 03/29/23, 15:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39833

  5. Georg Ringer commented on patch set 2 03/29/23, 20:44

    in which use cases do we have not site language and wouldn't it be better to just fallback to english? I can imagine that having such edge cases it doesn't help to get random variants based on the configured user language
  6. Benni Mack commented on patch set 2 03/30/23, 06:48

    Reply

    this is in Backend context, where we don't have a site language. createFromUserPreferences() also falls back to english again if there is no BE_USER.
  7. Benni Mack uploaded patch set 3 V -1 04/04/23, 08:10

  8. core-ci voted on patch set 3 V +1 04/04/23, 08:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40058

  9. Benni Mack updated the commit message in patch set 4 V +1 04/04/23, 12:46

  10. core-ci voted on patch set 4 V +1 04/04/23, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40086

  11. Benni Mack updated the commit message in patch set 5 V +1 04/04/23, 13:05

  12. Oliver Klee updated the commit message in patch set 6 04/04/23, 13:11

  13. core-ci voted on patch set 5 V +1 04/04/23, 13:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40087

  14. core-ci voted on patch set 6 V +1 04/04/23, 13:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/40088

  15. Marc Willmann commented on patch set 6 V +1 CR +1 04/04/23, 13:36

    Fixes https://forge.typo3.org/issues/100255 Thanks for caring. :)
  16. Kevin Appelt voted on patch set 6 V +2 CR +2 04/04/23, 13:39

  17. Kevin Appelt merged patch set 7 04/04/23, 13:39