sfIMessageSource interface.
Method Summary
-
append($message)
Adds a untranslated message to the source. Need to call save() to save the
messages to source.
-
array
catalogues()
Returns a list of catalogue as key and all it variants as value.
-
boolean
delete($message, $catalogue = 'messages')
Deletes a particular message from the specified catalogue.
-
string
getCulture()
Get the culture identifier for the source.
-
getId()
Returns a unique identifier for the current message source.
-
boolean
load($catalogue = 'messages')
Loads the translation table for this particular catalogue.
-
array
read()
Gets the translation table. This includes all the loaded sections.
-
boolean
save($catalogue = 'messages')
Saves the list of untranslated blocks to the translation source.
-
setCulture($culture)
Set the culture for this particular message source.
-
boolean
update($text, $target, $comments, $catalogue = 'messages')
Updates the translation.
Method Details
-
Adds a untranslated message to the source. Need to call save() to save the
messages to source.
-
Returns a list of catalogue as key and all it variants as value.
returns list of catalogues
-
(boolean) delete ($message, $catalogue = 'messages')
Browse code
| $message |
the source message to delete.
|
| $catalogue |
the catalogue to delete from.
|
Deletes a particular message from the specified catalogue.
returns true if deleted, false otherwise.
-
(string) getCulture ()
Browse code
Get the culture identifier for the source.
returns culture identifier.
-
Returns a unique identifier for the current message source.
-
(boolean) load ($catalogue = 'messages')
Browse code
| $catalogue |
a catalogue to load
|
Loads the translation table for this particular catalogue.
The translation should be loaded in the following order.
[1] call getCatalogueList($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].
returns true if loaded, false otherwise.
-
Gets 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.
array('catalogue+variant' =>
array('source string' => 'target string', ...)
...),
...);
returns 2 level array translation table.
-
(boolean) save ($catalogue = 'messages')
Browse code
| $catalogue |
the catalogue to add to
|
Saves 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.
returns true if saved successfuly, false otherwise.
-
| $culture |
the Culture name.
|
Set the culture for this particular message source.
-
(boolean) update ($text, $target, $comments, $catalogue = 'messages')
Browse code
| $text |
the source string.
|
| $target |
the new translation string.
|
| $comments |
comments
|
| $catalogue |
the catalogue of the translation.
|
Updates the translation.
returns true if translation was updated, false otherwise.
|