Issue Bug Closed

#79348Localization in TyposcriptFrontendController only allows defined Backend-Languages in TYPO3\CMS\Core\Localization\Locales

Tobias Eichelberger 01/17/17, 10:48 updated 03/05/21, 15:17

Description

Hi there,

we need two additional languages for our projects:
- cn
- tw

We wondered, why it is not possible to get the linked xlf-files
- /MyExtension/Resources/Private/Language/cn.locallang.xlf
- /MyExtension/Resources/Private/Language/tw.locallang.xlf

working, and found the reason in TyposcriptFrontendController->initLLvars:

In this method, TYPO3 decides wether $this->languageDependencies is written or not:

  // Language is found. Configure it:
  if (in_array($this->lang, $locales->getLocales())) { // this fails, due to getLocales!
      $this->languageDependencies[] = $this->lang;

$locales->getLocales() comes from TYPO3\CMS\Core\Localization\Locales, in which you can read: “Defining backend system languages”.

After that process TyposcriptFrontendController->readLLfile only loads locallang files, with a prefix from languageDependencies.

The problem now is:
If we need a language, which is not supported by TYPO3 backend/locales, we fail, even though it would be no problem to load and use the language with any other (wrong) prefix.

So my request/question is, to simply change the TyposcriptFrontendController->initLLvars as follows:

  // Language is found. Configure it:
  if (in_array($this->lang, $locales->getLocales()) || TYPO3_MODE === "FE") { //underline TYPO3_MODE == FE ;)
      $this->languageDependencies[] = $this->lang;

This would allow to use any iso2-language prefix in frontend.

Do you guys see any problems with that?

Best regards,
Duke

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.