PHP Интерфейс Prado\I18N\core\IMessageSource

All 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.
Показать файл Открыть проект

Открытые методы

Метод Описание
append ( $message ) : void Add a untranslated message to the source. Need to call save() to save the messages to source.
catalogues ( ) : array Returns a list of catalogue as key and all it variants as value.
delete ( $message, $catalogue = 'messages' ) : boolean Delete a particular message from the specified catalogue.
getCulture ( ) : string Get the culture identifier for the source.
load ( $catalogue = 'messages' ) : boolean Load the translation table for this particular catalogue.
read ( ) : array Get the translation table. This includes all the loaded sections.
save ( $catalogue = 'messages' ) : boolean Save the list of untranslated blocks to the translation source.
setCulture ( $culture ) Set the culture for this particular message source.
update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean Update the translation.

Описание методов

append() публичный метод

Add a untranslated message to the source. Need to call save() to save the messages to source.
public append ( $message ) : void
Результат void

catalogues() публичный метод

Returns a list of catalogue as key and all it variants as value.
public catalogues ( ) : array
Результат array list of catalogues

delete() публичный метод

Delete a particular message from the specified catalogue.
public delete ( $message, $catalogue = 'messages' ) : boolean
Результат boolean true if deleted, false otherwise.

getCulture() публичный метод

Get the culture identifier for the source.
public getCulture ( ) : string
Результат string culture identifier.

load() публичный метод

The translation should be loaded in the following order. # [1] call getCatalogeList($catalogue) to get a list of variants 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 load ( $catalogue = 'messages' ) : boolean
Результат boolean true if loaded, false otherwise.

read() публичный метод

It must return a 2 level array of translation strings. # "catalogue+variant" the catalogue and its variants. # "source string" translation keys, and its translations. array('catalogue+variant' => array('source string' => 'target string', ...) ...), ...);
public read ( ) : array
Результат array 2 level array translation table.

save() публичный метод

If the translation was not found, you should add those strings to the translation source via the append() method.
public save ( $catalogue = 'messages' ) : boolean
Результат boolean true if saved successfuly, false otherwise.

setCulture() публичный метод

Set the culture for this particular message source.
public setCulture ( $culture )

update() публичный метод

Update the translation.
public update ( $text, $target, $comments, $catalogue = 'messages' ) : boolean
Результат boolean true if translation was updated, false otherwise.