class MessageCatalogue implements MessageCatalogueInterface
MessageCatalogue.
Methods
|
__construct(string $locale, array $messages = array())
Constructor. |
||
| string |
getLocale()
Gets the catalogue locale. |
|
| array |
getDomains()
Gets the domains. |
|
| array |
all(string $domain = null)
Gets the messages within a given domain. |
|
|
set(string $id, string $translation, string $domain = 'messages')
Sets a message translation. |
||
| Boolean |
has(string $id, string $domain = 'messages')
Checks if a message has a translation. |
|
| Boolean |
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. |
|
|
replace(string $messages, string $domain = 'messages')
Sets translations for a given domain. |
||
|
add(string $messages, string $domain = 'messages')
Adds translations for a given domain. |
||
|
addCatalogue(MessageCatalogueInterface $catalogue)
Merges translations from the given Catalogue into the current one. |
||
|
addFallbackCatalogue(MessageCatalogueInterface $catalogue)
Merges translations from the given Catalogue into the current one only when the translation does not exist. |
||
| ResourceInterface[] |
getResources()
Returns an array of resources loaded to build this collection. |
|
|
addResource(ResourceInterface $resource)
Adds a resource for this collection. |
Details
at line 39
public
__construct(string $locale, array $messages = array())
Constructor.
at line 51
public string
getLocale()
Gets the catalogue locale.
at line 61
public array
getDomains()
Gets the domains.
at line 71
public array
all(string $domain = null)
Gets the messages within a given domain.
If $domain is null, it returns all messages.
at line 85
public
set(string $id, string $translation, string $domain = 'messages')
Sets a message translation.
at line 95
public Boolean
has(string $id, string $domain = 'messages')
Checks if a message has a translation.
at line 111
public Boolean
defines(string $id, string $domain = 'messages')
Checks if a message has a translation (it does not take into account the fallback mechanism).
at line 121
public string
get(string $id, string $domain = 'messages')
Gets a message translation.
at line 139
public
replace(string $messages, string $domain = 'messages')
Sets translations for a given domain.
at line 151
public
add(string $messages, string $domain = 'messages')
Adds translations for a given domain.
at line 165
public
addCatalogue(MessageCatalogueInterface $catalogue)
Merges translations from the given Catalogue into the current one.
The two catalogues must have the same locale.
at line 185
public
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.
at line 208
public ResourceInterface[]
getResources()
Returns an array of resources loaded to build this collection.
at line 218
public
addResource(ResourceInterface $resource)
Adds a resource for this collection.