Translator
extends Translator
in package
implements
WarmableInterface
Tags
Interfaces, Classes and Traits
- WarmableInterface
- Interface for classes that support warming their cache.
Table of Contents
- $container : mixed
- $loaderIds : mixed
- $options : mixed
- $enabledLocales : array<string|int, string>
- $resourceFiles : array<string|int, array<string|int, string>>
- $resourceLocales : array<int, string>
- $resources : array<string|int, array<string|int, mixed>>
- Holds parameters from addResource() calls so we can defer the actual parent::addResource() calls until initialize() is executed.
- $scannedDirectories : array<string|int, string>
- __construct() : mixed
- Constructor.
- addResource() : mixed
- warmUp() : array<string|int, string>
- Warms up the cache.
- initialize() : mixed
- initializeCatalogue() : mixed
- {@inheritdoc}
- addResourceFiles() : void
Properties
$container
protected
mixed
$container
$loaderIds
protected
mixed
$loaderIds
$options
protected
mixed
$options
= ['cache_dir' => null, 'debug' => false, 'resource_files' => [], 'scanned_directories' => [], 'cache_vary' => []]
$enabledLocales
private
array<string|int, string>
$enabledLocales
$resourceFiles
private
array<string|int, array<string|int, string>>
$resourceFiles
$resourceLocales
private
array<int, string>
$resourceLocales
$resources
Holds parameters from addResource() calls so we can defer the actual parent::addResource() calls until initialize() is executed.
private
array<string|int, array<string|int, mixed>>
$resources
= []
$scannedDirectories
private
array<string|int, string>
$scannedDirectories
Methods
__construct()
Constructor.
public
__construct(ContainerInterface $container, MessageFormatterInterface $formatter, string $defaultLocale[, array<string|int, mixed> $loaderIds = [] ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $enabledLocales = [] ]) : mixed
Available options:
- cache_dir: The cache directory (or null to disable caching)
- debug: Whether to enable debugging or not (false by default)
- resource_files: List of translation resources available grouped by locale.
- cache_vary: An array of data that is serialized to generate the cached catalogue name.
Parameters
- $container : ContainerInterface
- $formatter : MessageFormatterInterface
- $defaultLocale : string
- $loaderIds : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
- $enabledLocales : array<string|int, mixed> = []
Tags
Return values
mixed —addResource()
public
addResource(string $format, mixed $resource, string $locale[, string|null $domain = null ]) : mixed
Parameters
- $format : string
- $resource : mixed
- $locale : string
- $domain : string|null = null
Return values
mixed —warmUp()
Warms up the cache.
public
warmUp(string $cacheDir) : array<string|int, string>
Parameters
- $cacheDir : string
Return values
array<string|int, string> —initialize()
protected
initialize() : mixed
Return values
mixed —initializeCatalogue()
{@inheritdoc}
protected
initializeCatalogue(string $locale) : mixed
Parameters
- $locale : string
Return values
mixed —addResourceFiles()
private
addResourceFiles() : void