MessageCatalogueInterface
in
MessageCatalogueInterface.
Tags
Table of Contents
- INTL_DOMAIN_SUFFIX = '+intl-icu'
- add() : mixed
- Adds translations for a given domain.
- addCatalogue() : mixed
- Merges translations from the given Catalogue into the current one.
- addFallbackCatalogue() : mixed
- Merges translations from the given Catalogue into the current one only when the translation does not exist.
- addResource() : mixed
- Adds a resource for this collection.
- all() : array<string|int, mixed>
- Gets the messages within a given domain.
- defines() : bool
- Checks if a message has a translation (it does not take into account the fallback mechanism).
- get() : string
- Gets a message translation.
- getDomains() : array<string|int, mixed>
- Gets the domains.
- getFallbackCatalogue() : self|null
- Gets the fallback catalogue.
- getLocale() : string
- Gets the catalogue locale.
- getResources() : array<string|int, ResourceInterface>
- Returns an array of resources loaded to build this collection.
- has() : bool
- Checks if a message has a translation.
- replace() : mixed
- Sets translations for a given domain.
- set() : mixed
- Sets a message translation.
Constants
INTL_DOMAIN_SUFFIX
public
mixed
INTL_DOMAIN_SUFFIX
= '+intl-icu'
Methods
add()
Adds translations for a given domain.
public
add(array<string|int, mixed> $messages[, string $domain = 'messages' ]) : mixed
Parameters
- $messages : array<string|int, mixed>
-
An array of translations
- $domain : string = 'messages'
-
The domain name
Return values
mixed —addCatalogue()
Merges translations from the given Catalogue into the current one.
public
addCatalogue(self $catalogue) : mixed
The two catalogues must have the same locale.
Parameters
- $catalogue : self
Return values
mixed —addFallbackCatalogue()
Merges translations from the given Catalogue into the current one only when the translation does not exist.
public
addFallbackCatalogue(self $catalogue) : mixed
This is used to provide default translations when they do not exist for the current locale.
Parameters
- $catalogue : self
Return values
mixed —addResource()
Adds a resource for this collection.
public
addResource(ResourceInterface $resource) : mixed
Parameters
- $resource : ResourceInterface
Return values
mixed —all()
Gets the messages within a given domain.
public
all([string $domain = null ]) : array<string|int, mixed>
If $domain is null, it returns all messages.
Parameters
- $domain : string = null
-
The domain name
Return values
array<string|int, mixed> —An array of messages
defines()
Checks if a message has a translation (it does not take into account the fallback mechanism).
public
defines(string $id[, string $domain = 'messages' ]) : bool
Parameters
- $id : string
-
The message id
- $domain : string = 'messages'
-
The domain name
Return values
bool —true if the message has a translation, false otherwise
get()
Gets a message translation.
public
get(string $id[, string $domain = 'messages' ]) : string
Parameters
- $id : string
-
The message id
- $domain : string = 'messages'
-
The domain name
Return values
string —The message translation
getDomains()
Gets the domains.
public
getDomains() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of domains
getFallbackCatalogue()
Gets the fallback catalogue.
public
getFallbackCatalogue() : self|null
Return values
self|null —A MessageCatalogueInterface instance or null when no fallback has been set
getLocale()
Gets the catalogue locale.
public
getLocale() : string
Return values
string —The locale
getResources()
Returns an array of resources loaded to build this collection.
public
getResources() : array<string|int, ResourceInterface>
Return values
array<string|int, ResourceInterface> —An array of resources
has()
Checks if a message has a translation.
public
has(string $id[, string $domain = 'messages' ]) : bool
Parameters
- $id : string
-
The message id
- $domain : string = 'messages'
-
The domain name
Return values
bool —true if the message has a translation, false otherwise
replace()
Sets translations for a given domain.
public
replace(array<string|int, mixed> $messages[, string $domain = 'messages' ]) : mixed
Parameters
- $messages : array<string|int, mixed>
-
An array of translations
- $domain : string = 'messages'
-
The domain name
Return values
mixed —set()
Sets a message translation.
public
set(string $id, string $translation[, string $domain = 'messages' ]) : mixed
Parameters
- $id : string
-
The message id
- $translation : string
-
The messages translation
- $domain : string = 'messages'
-
The domain name