System.I18N.core
[ class tree: System.I18N.core ] [ index: System.I18N.core ] [ all elements ]

Class: IMessageSource

Source Location: /I18N/core/IMessageSource.php

Interface Overview


IMessageSource interface.

Class Details

[line 32]
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.




version:  v1.0, last update on Fri Dec 24 17:40:19 EST 2004
author:  Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>


[ Top ]

Methods



Class Methods


method append [line 83]

void append( string $message)

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



Parameters:

string   $message   message to add

[ Top ]

method catalogues [line 107]

array catalogues( )

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



return:  list of catalogues


[ Top ]

method delete [line 91]

boolean delete( string $message, [string $catalogue = 'messages'])

Delete a particular message from the specified catalogue.



return:  true if deleted, false otherwise.


Parameters:

string   $message   the source message to delete.
string   $catalogue   the catalogue to delete from.

[ Top ]

method getCulture [line 119]

string getCulture( )

Get the culture identifier for the source.



return:  culture identifier.


[ Top ]

method load [line 50]

boolean load( [string $catalogue = 'messages'])

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.


Parameters:

string   $catalogue   a catalogue to load

[ Top ]

method read [line 66]

array read( )

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.


[ Top ]

method save [line 75]

boolean save( [string $catalogue = 'messages'])

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.


Parameters:

string   $catalogue   the catalogue to add to

[ Top ]

method setCulture [line 113]

void setCulture( string $culture)

Set the culture for this particular message source.



Parameters:

string   $culture   the Culture name.

[ Top ]

method update [line 101]

boolean update( string $text, string $target, string $comments, [string $catalogue = 'messages'])

Update the translation.



return:  true if translation was updated, false otherwise.


Parameters:

string   $text   the source string.
string   $target   the new translation string.
string   $comments   comments
string   $catalogue   the catalogue of the translation.

[ Top ]


© 2004-2005 PRADO Software Group. All Rights Reserved.