MessageCatalogueInterface (Component\Translation)
Symfony\Component\Translation\MessageCatalogueInterface
interface MessageCatalogueInterface
MessageCatalogueInterface.
Methods
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. | ||
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. | |
replace(array $messages, string $domain = 'messages') Sets translations for a given domain. | ||
add(array $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. | ||
MessageCatalogueInterface|null | getFallbackCatalogue() Gets the fallback catalogue. | |
ResourceInterface[] | getResources() Returns an array of resources loaded to build this collection. | |
addResource(ResourceInterface $resource) Adds a resource for this collection. |
Details
public string getLocale()
Gets the catalogue locale.
public array getDomains()
Gets the domains.
public array all(string $domain = null)
Gets the messages within a given domain.
If $domain is null, it returns all messages.
public set(string $id, string $translation, string $domain = 'messages')
Sets a message translation.
public bool has(string $id, string $domain = 'messages')
Checks if a message has a translation.
public bool defines(string $id, string $domain = 'messages')
Checks if a message has a translation (it does not take into account the fallback mechanism).
public string get(string $id, string $domain = 'messages')
Gets a message translation.
public replace(array $messages, string $domain = 'messages')
Sets translations for a given domain.
public add(array $messages, string $domain = 'messages')
Adds translations for a given domain.
public addCatalogue(MessageCatalogueInterface $catalogue)
Merges translations from the given Catalogue into the current one.
The two catalogues must have the same locale.
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.
public MessageCatalogueInterface|null getFallbackCatalogue()
Gets the fallback catalogue.
public ResourceInterface[] getResources()
Returns an array of resources loaded to build this collection.
public addResource(ResourceInterface $resource)
Adds a resource for this collection.
© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Translation/MessageCatalogueInterface.html