LocalizationFactory
This class acts currently as facade around SymfonyTranslator.
User-land code should use LanguageService for the time being, and this class should not be exposed directly.
Ideally, consider using a runtime cache if needed, if not using LanguageService.
Hand in the locale to load, or english ("default").
What it does:
- Caches on a system-level cache
- Handles loading default (= english) before translated files
- Handles file name juggling of translated files.
- Handles localization overrides via $GLOBALS['TYPO3_CONF_VARS']['LANG']['resourceOverrides']
Table of Contents
Properties
- $labelFileResolver : LabelFileResolver
- $systemCache : FrontendInterface
- $translator : Translator
Methods
- __construct() : mixed
- getParsedData() : array<string, array<int, array<string, string>>>
- Returns parsed data from a given file and language key.
- applyLocalizationOverrides() : array<string|int, mixed>
- Apply localization overrides by merging override file contents
- convertCatalogueToLegacyFormat() : array<string|int, mixed>
- Convert Symfony MessageCatalogue to TYPO3's legacy format
- getMessageCatalogue() : MessageCatalogueInterface
- Load translations of one resource using Symfony Translator
- loadWithSymfonyTranslator() : array<string|int, mixed>
- Get the catalogue and convert to TYPO3 format
- parseIcuPlural() : array<string|int, mixed>
- Simple parser for ICU plural format - extracts plural values
Properties
$labelFileResolver
protected
LabelFileResolver
$labelFileResolver
$systemCache
protected
FrontendInterface
$systemCache
$translator
protected
Translator
$translator
Methods
__construct()
public
__construct(Translator $translator, FrontendInterface $systemCache, LabelFileResolver $labelFileResolver) : mixed
Parameters
- $translator : Translator
- $systemCache : FrontendInterface
- $labelFileResolver : LabelFileResolver
getParsedData()
Returns parsed data from a given file and language key.
public
getParsedData(string $fileReference, string $languageKey) : array<string, array<int, array<string, string>>>
Parameters
- $fileReference : string
-
Input is a file-reference (see \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName). That file is expected to be a supported locallang file format
- $languageKey : string
-
Language key
Return values
array<string, array<int, array<string, string>>>applyLocalizationOverrides()
Apply localization overrides by merging override file contents
protected
applyLocalizationOverrides(string $fileReference, string $languageKey, array<string|int, mixed> $labels) : array<string|int, mixed>
Parameters
- $fileReference : string
- $languageKey : string
- $labels : array<string|int, mixed>
Return values
array<string|int, mixed>convertCatalogueToLegacyFormat()
Convert Symfony MessageCatalogue to TYPO3's legacy format
protected
convertCatalogueToLegacyFormat(MessageCatalogueInterface $catalogue, MessageCatalogueInterface $fallbackCatalogue) : array<string|int, mixed>
Parameters
- $catalogue : MessageCatalogueInterface
- $fallbackCatalogue : MessageCatalogueInterface
Return values
array<string|int, mixed>getMessageCatalogue()
Load translations of one resource using Symfony Translator
protected
getMessageCatalogue(string $fileReference, string $locale[, bool $useDefault = true ]) : MessageCatalogueInterface
Parameters
- $fileReference : string
- $locale : string
- $useDefault : bool = true
Return values
MessageCatalogueInterfaceloadWithSymfonyTranslator()
Get the catalogue and convert to TYPO3 format
protected
loadWithSymfonyTranslator(string $fileReference, string $languageKey) : array<string|int, mixed>
Parameters
- $fileReference : string
- $languageKey : string
Return values
array<string|int, mixed>parseIcuPlural()
Simple parser for ICU plural format - extracts plural values
protected
parseIcuPlural(string $icuString) : array<string|int, mixed>
Parameters
- $icuString : string