| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
interface sfIMessageSource |
|---|
| 35 |
{ |
|---|
| 36 |
|
|---|
| 37 |
* Loads the translation table for this particular catalogue. |
|---|
| 38 |
* The translation should be loaded in the following order. |
|---|
| 39 |
* # [1] call getCatalogueList($catalogue) to get a list of variants for for the specified $catalogue. |
|---|
| 40 |
* # [2] for each of the variants, call getSource($variant) to get the resource, could be a file or catalogue ID. |
|---|
| 41 |
* # [3] verify that this resource is valid by calling isValidSource($source) |
|---|
| 42 |
* # [4] try to get the messages from the cache |
|---|
| 43 |
* # [5] if a cache miss, call load($source) to load the message array |
|---|
| 44 |
* # [6] store the messages to cache. |
|---|
| 45 |
* # [7] continue with the foreach loop, e.g. goto [2]. |
|---|
| 46 |
* |
|---|
| 47 |
* @param string $catalogue a catalogue to load |
|---|
| 48 |
* @return boolean true if loaded, false otherwise. |
|---|
| 49 |
*/ |
|---|
| 50 |
function load($catalogue = 'messages'); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
* Gets the translation table. This includes all the loaded sections. |
|---|
| 54 |
* It must return a 2 level array of translation strings. |
|---|
| 55 |
* # "catalogue+variant" the catalogue and its variants. |
|---|
| 56 |
* # "source string" translation keys, and its translations. |
|---|
| 57 |
* <code> |
|---|
| 58 |
* array('catalogue+variant' => |
|---|
| 59 |
* array('source string' => 'target string', ...) |
|---|
| 60 |
* ...), |
|---|
| 61 |
* ...); |
|---|
| 62 |
* </code> |
|---|
| 63 |
* |
|---|
| 64 |
* @return array 2 level array translation table. |
|---|
| 65 |
*/ |
|---|
| 66 |
function read(); |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
* Saves the list of untranslated blocks to the translation source. |
|---|
| 70 |
* If the translation was not found, you should add those |
|---|
| 71 |
* strings to the translation source via the <b>append()</b> method. |
|---|
| 72 |
* |
|---|
| 73 |
* @param string $catalogue the catalogue to add to |
|---|
| 74 |
* @return boolean true if saved successfuly, false otherwise. |
|---|
| 75 |
*/ |
|---|
| 76 |
function save($catalogue = 'messages'); |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
* Adds a untranslated message to the source. Need to call save() |
|---|
| 80 |
* to save the messages to source. |
|---|
| 81 |
* |
|---|
| 82 |
* @param string $message message to add |
|---|
| 83 |
* @return void |
|---|
| 84 |
*/ |
|---|
| 85 |
function append($message); |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
* Deletes a particular message from the specified catalogue. |
|---|
| 89 |
* |
|---|
| 90 |
* @param string $message the source message to delete. |
|---|
| 91 |
* @param string $catalogue the catalogue to delete from. |
|---|
| 92 |
* @return boolean true if deleted, false otherwise. |
|---|
| 93 |
*/ |
|---|
| 94 |
function delete($message, $catalogue = 'messages'); |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
* Updates the translation. |
|---|
| 98 |
* |
|---|
| 99 |
* @param string $text the source string. |
|---|
| 100 |
* @param string $target the new translation string. |
|---|
| 101 |
* @param string $comments comments |
|---|
| 102 |
* @param string $catalogue the catalogue of the translation. |
|---|
| 103 |
* @return boolean true if translation was updated, false otherwise. |
|---|
| 104 |
*/ |
|---|
| 105 |
function update($text, $target, $comments, $catalogue = 'messages'); |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
* Returns a list of catalogue as key and all it variants as value. |
|---|
| 109 |
* |
|---|
| 110 |
* @return array list of catalogues |
|---|
| 111 |
*/ |
|---|
| 112 |
function catalogues(); |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
* Set the culture for this particular message source. |
|---|
| 116 |
* |
|---|
| 117 |
* @param string $culture the Culture name. |
|---|
| 118 |
*/ |
|---|
| 119 |
function setCulture($culture); |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
* Get the culture identifier for the source. |
|---|
| 123 |
* |
|---|
| 124 |
* @return string culture identifier. |
|---|
| 125 |
*/ |
|---|
| 126 |
function getCulture(); |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
* Returns a unique identifier for the current message source. |
|---|
| 130 |
*/ |
|---|
| 131 |
function getId(); |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|