Feature: #107436 - Symfony Translation Component Integration
See forge#107436
Description
TYPO3 now utilizes the Symfony Translation component for reading localization label files - such as XLIFF and PO - instead of its custom localization parsers.
The migration brings several improvements:
- Standardized file parsing using Symfony's translation loaders
- Enhanced API for accessing translation catalogues
- Support for custom translation loaders following Symfony standards
The new system maintains backward compatibility while providing a modern foundation for future improvements with translatable labels.
In addition, all label-related configuration options have been
streamlined under the
$GLOBALS
namespace.
The following new configuration options have been introduced:
$GLOBALS
- Configure custom translation loaders['TYPO3_ CONF_ VARS'] ['LANG'] ['loader'] $GLOBALS
- Moved from SYS.lang['TYPO3_ CONF_ VARS'] ['LANG'] ['require Approved Localizations'] $GLOBALS
- Moved from SYS.lang['TYPO3_ CONF_ VARS'] ['LANG'] ['format'] $GLOBALS
- Moved from EXTCONF.lang['TYPO3_ CONF_ VARS'] ['LANG'] ['available Locales'] $GLOBALS
- Moved from SYS.locallangXMLOverride['TYPO3_ CONF_ VARS'] ['LANG'] ['resource Overrides']
Custom Translation Loaders
Extension developers can now implement custom translation loaders by implementing Symfony's translation loader interfaces:
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\MessageCatalogue;
class CustomLoader implements LoaderInterface
{
public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue
{
// Custom loading logic
$catalogue = new MessageCatalogue($locale);
// ... populate catalogue
return $catalogue;
}
}
Register custom loaders via configuration:
$GLOBALS['TYPO3_CONF_VARS']['LANG']['loader']['fileEnding'] = \MyExtension\Translation\CustomLoader::class;
Impact
All previous configuration options have been moved to the new
$GLOBALS
namespace, these are automatically
migrated to the new location when accessing the install tool.
Please note: This functionality only affects internal handling of translation files ("locallang" files). The public API of the localization system remains unchanged.