DataCollectorTranslator
in package
implements
TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface, WarmableInterface
Tags
Table of Contents
Interfaces
- TranslatorInterface
- TranslatorBagInterface
- LocaleAwareInterface
- WarmableInterface
- Interface for classes that support warming their cache.
Constants
- MESSAGE_DEFINED = 0
- MESSAGE_EQUALS_FALLBACK = 2
- MESSAGE_MISSING = 1
Properties
- $messages : array<string|int, mixed>
- $translator : mixed
Methods
- __call() : mixed
- Passes through all unknown calls onto the translator object.
- __construct() : mixed
- getCatalogue() : MessageCatalogueInterface
- Gets the catalogue by locale.
- getCatalogues() : array<string|int, MessageCatalogueInterface>
- Returns all catalogues of the instance.
- getCollectedMessages() : array<string|int, mixed>
- getFallbackLocales() : array<string|int, mixed>
- Gets the fallback locales.
- getLocale() : string
- Returns the default locale.
- setLocale() : mixed
- Sets the current locale.
- trans() : string
- Translates the given message.
- warmUp() : array<string|int, string>
- 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
array<string|int, mixed>
$messages
= []
$translator
private
mixed
$translator
Methods
__call()
Passes through all unknown calls onto the translator object.
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
- $args : array<string|int, mixed>
__construct()
public
__construct(TranslatorInterface|TranslatorBagInterface|LocaleAwareInterface $translator) : mixed
Parameters
- $translator : TranslatorInterface|TranslatorBagInterface|LocaleAwareInterface
getCatalogue()
Gets the catalogue by locale.
public
getCatalogue([string $locale = null ]) : MessageCatalogueInterface
Parameters
- $locale : string = null
-
The locale or null to use the default
Return values
MessageCatalogueInterfacegetCatalogues()
Returns all catalogues of the instance.
public
getCatalogues() : array<string|int, MessageCatalogueInterface>
Return values
array<string|int, 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>getLocale()
Returns the default locale.
public
getLocale() : string
Return values
stringsetLocale()
Sets the current locale.
public
setLocale(string $locale) : mixed
Parameters
- $locale : string
trans()
Translates the given message.
public
trans(string|null $id[, array<string|int, mixed> $parameters = [] ][, string $domain = null ][, string $locale = null ]) : string
Parameters
- $id : string|null
-
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 : string = null
-
The domain for the message or null to use the default
- $locale : string = null
-
The locale or null to use the default
Return values
stringwarmUp()
Warms up the cache.
public
warmUp(string $cacheDir) : array<string|int, string>
Parameters
- $cacheDir : string
Return values
array<string|int, string>collectMessage()
private
collectMessage(string|null $locale, string|null $domain, string $id, string $translation[, array<string|int, mixed>|null $parameters = [] ]) : mixed
Parameters
- $locale : string|null
- $domain : string|null
- $id : string
- $translation : string
- $parameters : array<string|int, mixed>|null = []