Bug #100176
closedTranslations not available in v12.2 when using language key with country in site config
100%
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.
Updated by Chris Müller over 1 year ago
- Related to Bug #98501: Cannot open uncached frontend with invoked f:translate view helper added
Updated by Marcus Schwemer over 1 year ago
Hi
Thanks for filing this issue. I can confirm it. Same behavior here.
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
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.
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
- 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)
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.
Updated by Chris Müller over 1 year ago
- Related to Bug #100255: Language of backend user influence FE translations added
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
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
Updated by Benni Mack over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4518a1f448f79def204c8e079aa1fdb4ac42ac51.