Breaking: #107436 - Localization system architecture changes
See forge#107436
Description
The TYPO3 localization system has been migrated to use Symfony Translation components under the hood (see Feature: #107436 - Symfony Translation Component Integration), resulting in several breaking changes to the internals of localization API.
This functionality only affects internal handling of translation files ("locallang" files). The public API of the localization system remains unchanged.
Method Signature Changes
The
\TYPO3\
method has a modified signature and behavior:
// Before
public function getParsedData($fileReference, $languageKey, $_ = null, $__ = null, $isLocalizationOverride = false)
// After
public function getParsedData(string $fileReference, string $languageKey, bool $isLocalizationOverride = false): array
Language Key Changes
Internally, the localization system now replaces the internal fallback language key from "default" to "en". Note that this does not affect public API, where "default" can of course still map to any configured language key other than "en".
Configuration Changes
Custom parser configuration is no longer supported. The global configuration
option
$GLOBALS
has been
removed and custom parsers configured through this option will be ignored.
Several configuration options have been moved or renamed:
$GLOBALS
['TYPO3_ CONF_ VARS'] ['SYS'] ['lang'] ['parser'] $GLOBALS
→['TYPO3_ CONF_ VARS'] ['SYS'] ['lang'] ['require Approved Localizations'] $GLOBALS
['TYPO3_ CONF_ VARS'] ['LANG'] ['require Approved Localizations'] $GLOBALS
→['TYPO3_ CONF_ VARS'] ['SYS'] ['lang'] ['format'] $GLOBALS
['TYPO3_ CONF_ VARS'] ['LANG'] ['format'] $GLOBALS
→['TYPO3_ CONF_ VARS'] ['EXTCONF'] ['lang'] ['available Languages'] $GLOBALS
['TYPO3_ CONF_ VARS'] ['LANG'] ['available Locales'] $GLOBALS
→['TYPO3_ CONF_ VARS'] ['SYS'] ['locallang XMLOverride'] $GLOBALS
['TYPO3_ CONF_ VARS'] ['LANG'] ['resource Overrides']
Impact
Code calling
Localization
with the old signature
or expecting "default" as a resulting language key will break:
- The method now requires strict type parameters
- The method now returns "en" instead of "default" for English translations
- Unused parameters have been removed
Extensions that register custom localization parsers via
$GLOBALS
will find their
parsers are no longer executed, potentially causing missing translations.
Extensions or installations using the moved configuration options will need to update their configuration to use the new option paths. The old configuration options are no longer recognized and will be ignored.
Affected installations
Installations that:
- Call
Localization
directlyFactory:: get Parsed Data () - Have custom localization parsers registered via the removed configuration option
- Accessing any of the migrated configuration options above.
Migration
Method Call Updates
Update calls to
get
to use the new signature, and ensure
types are matching:
// Before
$data = $factory->getParsedData($fileReference, $languageKey, null, null, false);
// After
$data = $factory->getParsedData($fileReference, $languageKey, false);
Custom Parser Migration
Replace custom parsers with Symfony Translation loaders. See the Feature RST Feature: #107436 - Symfony Translation Component Integration for detailed migration instructions to the new loader system.