Interface IMessageSource

Description

IMessageSource interface.

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.

Located in /I18N/core/IMessageSource.php (line 32)


	
			
Method Summary
void append (string $message)
array catalogues ()
boolean delete (string $message, [string $catalogue = 'messages'])
string getCulture ()
boolean load ([string $catalogue = 'messages'])
array read ()
boolean save ([string $catalogue = 'messages'])
void setCulture (string $culture)
boolean update (string $text, string $target, string $comments, [string $catalogue = 'messages'])
Methods
append (line 83)

Add a untranslated message to the source. Need to call save() to save the messages to source.

void append (string $message)
  • string $message: message to add
catalogues (line 107)

Returns a list of catalogue as key and all it variants as value.

  • return: list of catalogues
array catalogues ()
delete (line 91)

Delete a particular message from the specified catalogue.

  • return: true if deleted, false otherwise.
boolean delete (string $message, [string $catalogue = 'messages'])
  • string $message: the source message to delete.
  • string $catalogue: the catalogue to delete from.
getCulture (line 119)

Get the culture identifier for the source.

  • return: culture identifier.
string getCulture ()
load (line 50)

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 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].

  • return: true if loaded, false otherwise.
boolean load ([string $catalogue = 'messages'])
  • string $catalogue: a catalogue to load
read (line 66)

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.
    1. array('catalogue+variant' =>
    2. array('source string' => 'target string', ...)
    3. ...),
    4. ...);

  • return: 2 level array translation table.
array read ()
save (line 75)

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.

  • return: true if saved successfuly, false otherwise.
boolean save ([string $catalogue = 'messages'])
  • string $catalogue: the catalogue to add to
setCulture (line 113)

Set the culture for this particular message source.

void setCulture (string $culture)
  • string $culture: the Culture name.
update (line 101)

Update the translation.

  • return: true if translation was updated, false otherwise.
boolean update (string $text, string $target, string $comments, [string $catalogue = 'messages'])
  • string $text: the source string.
  • string $target: the new translation string.
  • string $comments: comments
  • string $catalogue: the catalogue of the translation.

Documentation generated on Sun, 04 Jun 2006 18:58:26 -0400 by phpDocumentor 1.3.0RC4