Project

General

Profile

Actions

Bug #104774

open

ContentObjectRenderer initializes the LanguageService incorrectly ignoring set "typo3Language"

Added by Denis Mir 3 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
Start date:
2024-08-29
Due date:
% Done:

0%

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

Description

The "\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer" does incorrectly initialize the "\TYPO3\CMS\Core\Localization\LanguageService" which leads to ignoring the set `typo3Language`. Yes it is deprecated but there are discussions about reverting it. (see here https://forge.typo3.org/issues/103887)

"\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getData" does the initialization like so:

$languageService = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromSiteLanguage($this->getTypoScriptFrontendController()->getLanguage());

that means it uses

\TYPO3\CMS\Core\Localization\LanguageServiceFactory::createFromSiteLanguage

to init the locale.

This is in contrast to the "\TYPO3\CMS\Extbase\Utility\LocalizationUtility" and the "\TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper" which do both use:

\TYPO3\CMS\Core\Localization\Locales::createLocaleFromRequest

to init the locale.

In the end it leads to a mixed usage of locallang files and to a different output for the same language key depending on the context. (extbase or typoscript)

No data to display

Actions

Also available in: Atom PDF