Project

General

Profile

Actions

Feature #103887

open

Site config / Site language based language file handling for FRONTEND required since deprecation of "typo3Language" - controlling it by locale only is not enough in every use case

Added by Denis Mir about 1 month ago. Updated 17 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2024-05-23
Due date:
% Done:

0%

Estimated time:
PHP Version:
8.2
Tags:
Complexity:
Sprint Focus:

Description

With the deprecation of the SiteLanguage property "typo3Language" in 12LTS it became impossible to have different language files for site languages with the same "locale".

One quick example from our work with various big companies.

Lets say company X has different websites for different countries in the same TYPO3 instance and every page has an english variant (site language).

So lets say:

Website Germany (Site Config "site_germany")
  • English for Germany (in 11LTS "locale" -> "en_GB" and "typo3Language" -> "en_DE")
  • German ("locale" and "typo3Language" -> "de_DE")
Website Hungary (Site Config "site_hungary")
  • English for Hungary (in 11LTS "locale" -> "en_GB" and "typo3Language" -> "en_HR")
  • Hungarian ("locale" and "typo3Language" -> "hr_HR")

In this case not every label for "en_DE" has the same translation like for "en_HR". Most of the time they are the same but in nuances they often vary. So one single "locallang.xlf" for english is not enough.

With 11LTS it was possible to just keep the locale at "en_GB" but control the chosen language files by adding custom languages ("en_HR", "en_DE" etc.) which was possible by the "custom language" feature found here https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/Localization/ManagingTranslations.html#xliff-translating-languages and setting this custom language in the "typo3Language" of the site language. So in the end you had a "locallang.xlf" for the labels and variations of it by "en_DE.locallang.xlf" or "en_HR.locallang.xlf".

In 12LTS "typo3Language" is getting deprecated now (https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/SiteHandling/AddLanguages.html#confval-sitehandling-addinglanguages-typo3language) and the language files are getting controlled only by the "locale" property.

This means that the use case above is no longer possible to implement.

For sure you could set an invented locale like "en_DE" for the "locale" property but this would first render e.g. every locale based formatting useless. And second it would spam the logs with "Locale en_DE not found." error messages coming from "\TYPO3\CMS\Core\Localization\Locales::setLocale".

In the end we need this dropped feature back since custom languages are now only usable in the backend but no longer in the frontend.

In a lengthy discussion in the TYPO3 slack right here https://typo3.slack.com/archives/C025BQLFA/p1716372529432749 Stefan Bürk came up with the idea of site identifier based language files like "locallang_db.site-identifier.de-DE.xliff". (https://typo3.slack.com/archives/C025BQLFA/p1716463354137249?thread_ts=1716372529.432749&cid=C025BQLFA)
I think we would even need a site-language based approach since you can have websites that have multiple english variants in the same site config that share the same locale (e.g. "en_GB") but need different language files.

Actions

Also available in: Atom PDF