Project

General

Profile

Actions

Bug #100176

closed

Translations not available in v12.2 when using language key with country in site config

Added by Chris Müller over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Localization
Target version:
Start date:
2023-03-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In my site configuration the locale field of a language configuration is set to "de_DE.utf8". This results in a locale "de-DE" for translation.

This is now also used in LocalizationFactory when retrieving the translations via getParsedData() method.

As the translation file is named "de.locallang.xlf" but the mentioned method resolves the path to "de-DE.locallang.xlf" the translations falls back to the default language (English, what is not wanted on a German page).

When I change the locallang file to "de-DE.locallang.xlf" the translation works. But this is not what is wanted, especially when having multiple countries for the same language, like de-DE, de-AT, de-CH and just want to override some labels for a specific country.

I use <f:translate> view helper in a page template when the error occurred (non-Extbase context). Using the view helper in Extbase context seems to work.

Another observation: When logged-in into the backend and using the translate view helper out of Extbase in frontend, the getLanguageService() method of the view helper returns $GLOBALS['LANG'] early. Which means, the language is based on the language of the backend user, not the language of the frontend page.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #98501: Cannot open uncached frontend with invoked f:translate view helperClosed2022-10-02

Actions
Related to TYPO3 Core - Bug #100030: Translation handling: Fallback chain is broken if backend user is logged in. ClosedBenni Mack2023-02-24

Actions
Related to TYPO3 Core - Bug #100255: Language of backend user influence FE translationsClosed2023-03-22

Actions
Actions #1

Updated by Chris Müller over 1 year ago

  • Description updated (diff)
Actions #2

Updated by Chris Müller over 1 year ago

  • Description updated (diff)
Actions #3

Updated by Chris Müller over 1 year ago

  • Description updated (diff)
Actions #4

Updated by Chris Müller over 1 year ago

  • Related to Bug #98501: Cannot open uncached frontend with invoked f:translate view helper added
Actions #5

Updated by Marcus Schwemer over 1 year ago

Hi

Thanks for filing this issue. I can confirm it. Same behavior here.

Actions #6

Updated by Timo Webler over 1 year ago

  • Related to Bug #100030: Translation handling: Fallback chain is broken if backend user is logged in. added
Actions #7

Updated by Benni Mack over 1 year ago

Thanks Timo, for referencing!

Can you test latest dev-main branch? I've fixed this and it got merged yesterday.

Actions #8

Updated by Kevin Appelt over 1 year ago

  • Status changed from New to Accepted

@Benni Mack I can confirm, that this is still broken (read as: does not take de.locallang.xlf into account) in current dev-main in some cases.

What seems not to work:
  • f:translate ViewHelper in Extbase Plugins
  • f:translate ViewHelper in Page Layout
What seems to work:
  • f:translate ViewHelper in Extbase Plugins (yes, again! I really don't understand why it works in one extension but not another, while they seem to be identical and it works in both extensions with TYPO3 v11)
  • LocalizationUtility::translate() (if it makes a difference: used in a ViewHelper)

No typo3language, iso-6t39-1, hreflang or direction is present in the site configuration anymore, just locale (configured as de_DE.UTF8)

Actions #9

Updated by Wittkiel Gruppe over 1 year ago

This problem still exists in TYPO3 12.3.0 (not logged in BE).

Language-Settings:

languages:
  -
    title: Deutsch
    enabled: true
    languageId: 0
    base: /
    locale: de_DE.UTF-8
    navigationTitle: Deutsch
    flag: de
    websiteTitle: ''

Fluid-Viewhelper:

<f:translate key="tx_myext.title" extensionName="myext" />

de.locallang.xlf:

<trans-unit id="tx_myext.title" xml:space="preserve" approved="yes">
<source>Title</source>
<target>Titel</target>
</trans-unit>

locallang.xlf:

<trans-unit id="tx_myext.title" xml:space="preserve">
<source>Title</source>
</trans-unit>

False output with german FE: Title
Expected output with german FE: Titel

Additional note: with "typo3Language: de" in config.yaml it works.

Actions #10

Updated by Chris Müller over 1 year ago

  • Related to Bug #100255: Language of backend user influence FE translations added
Actions #11

Updated by Gerrit Code Review over 1 year ago

  • Status changed from Accepted to Under Review

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78325

Actions #12

Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78325

Actions #13

Updated by Benni Mack over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #14

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF