DataCollectorTranslator
in package
implements
TranslatorInterface, TranslatorInterface, TranslatorBagInterface, WarmableInterface
Tags
Interfaces, Classes, Traits and Enums
- TranslatorInterface
- TranslatorInterface.
- TranslatorInterface
- TranslatorBagInterface
- TranslatorBagInterface.
- WarmableInterface
- Interface for classes that support warming their cache.
Table of Contents
- MESSAGE_DEFINED = 0
- MESSAGE_EQUALS_FALLBACK = 2
- MESSAGE_MISSING = 1
- $messages : mixed
- $translator : TranslatorInterface|TranslatorBagInterface
- __call() : mixed
- Passes through all unknown calls onto the translator object.
- __construct() : mixed
- getCatalogue() : MessageCatalogueInterface
- Gets the catalogue by locale.
- getCollectedMessages() : array<string|int, mixed>
- getFallbackLocales() : array<string|int, mixed>
- Gets the fallback locales.
- getLocale() : string
- Returns the current locale.
- setLocale() : mixed
- Sets the current locale.
- trans() : string
- Translates the given message.
- transChoice() : string
- Translates the given choice message by choosing a translation according to a number.
- warmUp() : mixed
- Warms up the cache.
- collectMessage() : mixed
Constants
MESSAGE_DEFINED
public
mixed
MESSAGE_DEFINED
= 0
MESSAGE_EQUALS_FALLBACK
public
mixed
MESSAGE_EQUALS_FALLBACK
= 2
MESSAGE_MISSING
public
mixed
MESSAGE_MISSING
= 1
Properties
$messages
private
mixed
$messages
= []
$translator
private
TranslatorInterface|TranslatorBagInterface
$translator
Methods
__call()
Passes through all unknown calls onto the translator object.
public
__call(mixed $method, mixed $args) : mixed
Parameters
- $method : mixed
- $args : mixed
Return values
mixed —__construct()
public
__construct(TranslatorInterface $translator) : mixed
Parameters
- $translator : TranslatorInterface
-
The translator must implement TranslatorBagInterface
Return values
mixed —getCatalogue()
Gets the catalogue by locale.
public
getCatalogue([mixed $locale = null ]) : MessageCatalogueInterface
Parameters
- $locale : mixed = null
-
The locale or null to use the default
Return values
MessageCatalogueInterface —getCollectedMessages()
public
getCollectedMessages() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFallbackLocales()
Gets the fallback locales.
public
getFallbackLocales() : array<string|int, mixed>
Return values
array<string|int, mixed> —The fallback locales
getLocale()
Returns the current locale.
public
getLocale() : string
Return values
string —The locale
setLocale()
Sets the current locale.
public
setLocale(mixed $locale) : mixed
Parameters
- $locale : mixed
-
The locale
Return values
mixed —trans()
Translates the given message.
public
trans(mixed $id[, array<string|int, mixed> $parameters = [] ][, mixed $domain = null ][, mixed $locale = null ]) : string
Parameters
- $id : mixed
-
The message id (may also be an object that can be cast to string)
- $parameters : array<string|int, mixed> = []
-
An array of parameters for the message
- $domain : mixed = null
-
The domain for the message or null to use the default
- $locale : mixed = null
-
The locale or null to use the default
Return values
string —The translated string
transChoice()
Translates the given choice message by choosing a translation according to a number.
public
transChoice(mixed $id, mixed $number[, array<string|int, mixed> $parameters = [] ][, mixed $domain = null ][, mixed $locale = null ]) : string
Parameters
- $id : mixed
-
The message id (may also be an object that can be cast to string)
- $number : mixed
-
The number to use to find the index of the message
- $parameters : array<string|int, mixed> = []
-
An array of parameters for the message
- $domain : mixed = null
-
The domain for the message or null to use the default
- $locale : mixed = null
-
The locale or null to use the default
Tags
Return values
string —The translated string
warmUp()
Warms up the cache.
public
warmUp(mixed $cacheDir) : mixed
Parameters
- $cacheDir : mixed
-
The cache directory
Return values
mixed —collectMessage()
private
collectMessage(string|null $locale, string|null $domain, string|null $id, string $translation[, array<string|int, mixed>|null $parameters = [] ]) : mixed
Parameters
- $locale : string|null
- $domain : string|null
- $id : string|null
- $translation : string
- $parameters : array<string|int, mixed>|null = []