LocalizationFactory

Read onlyYes

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']

This class only deals with full files, "resources" a.k.a. "translation domains" right now. It does not care about the actual identifier WITHIN this label bag.

The main issue with this class is that it does not resolve proper dependencies, thus the fallback logic is marode. You can see this when checking for ArrayUtility both here and in LanguageService.

Table of Contents

Constants

MOVED_FILES  = [ // @todo: remove the following files in TYPO3 v15.0, they serve as a fallback for old syntax and files that have been moved 'EXT:dashboard/Resources/Private/Language/locallang_tca.xlf' => 'EXT:dashboard/Resources/Private/Language/db.xlf', 'EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf' => 'EXT:filemetadata/Resources/Private/Language/db.xlf', 'EXT:impexp/Resources/Private/Language/locallang_tca.xlf' => 'EXT:impexp/Resources/Private/Language/db.xlf', 'EXT:seo/Resources/Private/Language/locallang_tca.xlf' => 'EXT:seo/Resources/Private/Language/db.xlf', ]

Properties

$labelFileResolver  : LabelFileResolver
$runtimeCache  : FrontendInterface
$systemCache  : FrontendInterface
$translationDomainMapper  : TranslationDomainMapper
$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

Constants

MOVED_FILES

protected mixed MOVED_FILES = [ // @todo: remove the following files in TYPO3 v15.0, they serve as a fallback for old syntax and files that have been moved 'EXT:dashboard/Resources/Private/Language/locallang_tca.xlf' => 'EXT:dashboard/Resources/Private/Language/db.xlf', 'EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf' => 'EXT:filemetadata/Resources/Private/Language/db.xlf', 'EXT:impexp/Resources/Private/Language/locallang_tca.xlf' => 'EXT:impexp/Resources/Private/Language/db.xlf', 'EXT:seo/Resources/Private/Language/locallang_tca.xlf' => 'EXT:seo/Resources/Private/Language/db.xlf', ]

Properties

$translator

protected Translator $translator

Methods

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, string $domain) : array<string|int, mixed>
Parameters
$catalogue : MessageCatalogueInterface
$fallbackCatalogue : MessageCatalogueInterface
$domain : string
Return values
array<string|int, mixed>

getMessageCatalogue()

Load translations of one resource using Symfony Translator

protected getMessageCatalogue(string $fileReference, string $locale, string $domainName[, bool $useDefault = true ]) : MessageCatalogueInterface
Parameters
$fileReference : string
$locale : string
$domainName : string
$useDefault : bool = true
Return values
MessageCatalogueInterface

loadWithSymfonyTranslator()

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
Return values
array<string|int, mixed>

        
On this page

Search results