interface MessageCatalogueInterface

MessageCatalogueInterface.

Constants

INTL_DOMAIN_SUFFIX

Methods

string
getLocale()

Gets the catalogue locale.

array
getDomains()

Gets the domains.

array
all(string$domain =null)

Gets the messages within a given domain.

void
set(string$id,string$translation,string$domain ='messages')

Sets a message translation.

bool
has(string$id,string$domain ='messages')

Checks if a message has a translation.

bool
defines(string$id,string$domain ='messages')

Checks if a message has a translation (it does not take into account the fallback mechanism).

string
get(string$id,string$domain ='messages')

Gets a message translation.

void
replace(array$messages,string$domain ='messages')

Sets translations for a given domain.

void
add(array$messages,string$domain ='messages')

Adds translations for a given domain.

void
addCatalogue(MessageCatalogueInterface$catalogue)

Merges translations from the given Catalogue into the current one.

void
addFallbackCatalogue(MessageCatalogueInterface$catalogue)

Merges translations from the given Catalogue into the current one only when the translation does not exist.

getFallbackCatalogue()

Gets the fallback catalogue.

array
getResources()

Returns an array of resources loaded to build this collection.

void
addResource(ResourceInterface$resource)

Adds a resource for this collection.

Details

string getLocale()

Gets the catalogue locale.

Return Value

string

array getDomains()

Gets the domains.

Return Value

array

array all(string$domain =null)

Gets the messages within a given domain.

If $domain is null, it returns all messages.

Parameters

string $domain

Return Value

array

void set(string$id,string$translation,string$domain ='messages')

Sets a message translation.

Parameters

string $id The message id
string $translation The messages translation
string $domain The domain name

Return Value

void

bool has(string$id,string$domain ='messages')

Checks if a message has a translation.

Parameters

string $id The message id
string $domain The domain name

Return Value

bool

bool defines(string$id,string$domain ='messages')

Checks if a message has a translation (it does not take into account the fallback mechanism).

Parameters

string $id The message id
string $domain The domain name

Return Value

bool

string get(string$id,string$domain ='messages')

Gets a message translation.

Parameters

string $id The message id
string $domain The domain name

Return Value

string

void replace(array$messages,string$domain ='messages')

Sets translations for a given domain.

Parameters

array $messages An array of translations
string $domain The domain name

Return Value

void

void add(array$messages,string$domain ='messages')

Adds translations for a given domain.

Parameters

array $messages An array of translations
string $domain The domain name

Return Value

void

void addCatalogue(MessageCatalogueInterface$catalogue)

Merges translations from the given Catalogue into the current one.

The two catalogues must have the same locale.

Parameters

MessageCatalogueInterface $catalogue

Return Value

void

void addFallbackCatalogue(MessageCatalogueInterface$catalogue)

Merges translations from the given Catalogue into the current one only when the translation does not exist.

This is used to provide default translations when they do not exist for the current locale.

Parameters

MessageCatalogueInterface $catalogue

Return Value

void

MessageCatalogueInterface|null getFallbackCatalogue()

Gets the fallback catalogue.

Return Value

MessageCatalogueInterface|null

array getResources()

Returns an array of resources loaded to build this collection.

Return Value

array

void addResource(ResourceInterface$resource)

Adds a resource for this collection.

Parameters

ResourceInterface $resource

Return Value

void