[FEATURE] Add unified Locale class (IETF RFC 5646)
A new locale class is added in order to migrate the code base and the configuration towards real locales in form of RFC 5646 language tag (en-AT) and optional script code ("Hans") and optional country / region based on ISO 3166-1. This unifies handling of locales instead of dealing with "default" or other TYPO3-specific namings in user-land code and configuration. This locale functionality at first serves to handle "label files" (XLF), but will be further extended to also work with the locale to be used in the SiteLanguage object to simplify configuration and Date/Time Formatting based on php-intl. Thus, the first and foremost topic is to allow to create custom "LanguageService" objects out of a defined Locale instead of a string. The locale class contains the actual locale (such as "de-AT" or "en") but also allows to use the backwards-compatibility for the labels internally. It also contains the dependencies, so they do not need to be evaluated in various places and makes the public facing API much easier to understand. Next to the introduction of the Locale object, this patch also adapts various places which touch current LanguageService instantiations to use the Locale. Next Steps: * SiteLanguage.locale should use the object, as Locale uses a \Stringable interface. * Reduce optional settings in Site Language object and editing interface * A new languageService ($GLOBALS[LANG]) could and should be instantiated where it is needed, and not by re-using the same $GLOBALS[LANG] as this is needed This Reduce usages on $GLOBALS[LANG] by building a new LanguageService object based on the Context everywhere. * Ideally deprecate $GLOBALS[LANG] in TYPO3 v12 LTS. Resolves: #99694 Releases: main Change-Id: I9e2464699a2e53f4e3b136e0b66351f9f3aaf71f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77558 Tested-by:core-ci <typo3@b13.com> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/backend/Classes/Controller/LoginController.php 1 addition, 1 deletiontypo3/sysext/backend/Classes/Controller/LoginController.php
- typo3/sysext/core/Classes/Localization/LanguageService.php 48 additions, 41 deletionstypo3/sysext/core/Classes/Localization/LanguageService.php
- typo3/sysext/core/Classes/Localization/LanguageServiceFactory.php 9 additions, 6 deletions...sext/core/Classes/Localization/LanguageServiceFactory.php
- typo3/sysext/core/Classes/Localization/Locale.php 116 additions, 0 deletionstypo3/sysext/core/Classes/Localization/Locale.php
- typo3/sysext/core/Classes/Localization/Locales.php 13 additions, 0 deletionstypo3/sysext/core/Classes/Localization/Locales.php
- typo3/sysext/core/Documentation/Changelog/12.2/Feature-99694-UnifiedLocaleHandlingForTranslationFilesXLF.rst 52 additions, 0 deletions...ure-99694-UnifiedLocaleHandlingForTranslationFilesXLF.rst
- typo3/sysext/core/Tests/Unit/Localization/LocaleTest.php 103 additions, 0 deletionstypo3/sysext/core/Tests/Unit/Localization/LocaleTest.php
- typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php 3 additions, 4 deletionstypo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php 3 additions, 1 deletion.../frontend/Classes/ContentObject/ContentObjectRenderer.php
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php 3 additions, 13 deletions...ntend/Classes/Controller/TypoScriptFrontendController.php
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php 7 additions, 1 deletion...nd/Tests/Unit/ContentObject/ContentObjectRendererTest.php
- typo3/sysext/install/Classes/Controller/MaintenanceController.php 1 addition, 1 deletion...sext/install/Classes/Controller/MaintenanceController.php
Please register or sign in to comment