Interface \Prado\I18N\core\IMessageSource
IMessageSource interface.
Namespace: \Prado\I18N\coreAll messages source used by MessageFormat must be of IMessageSource. It defines a set of operations to add and retrive messages from the message source. In addition, message source can load a particular catalogue.
Author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>
public
|
append(string $message) : mixed
Add a untranslated message to the source. Need to call save()
to save the messages to source.
|
public
|
catalogues() : array<string|int, mixed>
Returns a list of catalogue as key and all it variants as value.
|
public
|
delete(string $message[, string $catalogue = 'messages' ]) : bool
Delete a particular message from the specified catalogue.
|
public
|
|
public
|
load([string $catalogue = 'messages' ]) : bool
Load the translation table for this particular catalogue.
The translation should be loaded in the following order. [1] call getCatalogeList($catalogue) to get a list ofvariants for for the specified $catalogue. [2] for each of the variants, call getSource($variant)to get the resource, could be a file or catalogue ID. [3] verify that this resource is valid by calling isValidSource($source)[4] try to get the messages from the cache[5] if a cache miss, call load($source) to load the message array[6] store the messages to cache.[7] continue with the foreach loop, e.g. goto [2]. |
public
|
read() : array<string|int, mixed>
Get the translation table. This includes all the loaded sections.
It must return a 2 level array of translation strings. "catalogue+variant" the catalogue and its variants."source string" translation keys, and its translations.
|
public
|
save([string $catalogue = 'messages' ]) : bool
Save the list of untranslated blocks to the translation source.
If the translation was not found, you should add those strings to the translation source via the append() method. |
public
|
|
public
|
update(string $text, string $target, string $comments[, string $catalogue = 'messages' ]) : bool
Update the translation.
|
|