MessageFormat class.
Format a message, that is, for a particular message find the translated message. The following is an example using a SQLite database to store the translation message. Create a new message format instance and echo "Hello" in simplified Chinese. This assumes that the world "Hello" is translated in the database.
- $source = MessageSource::factory('SQLite', 'sqlite://messages.db');
- $source->setCulture('zh_CN');
- $source->setCache(new MessageCache('./tmp'));
- $formatter = new MessageFormat($source);
- echo $formatter->format('Hello');
Located in /I18N/core/MessageFormat.php (line 54)
A list of loaded message catalogues.
Set the default catalogue.
Output encoding charset
The translation messages.
The prefix and suffix to append to untranslated messages.
The message source.
A list of untranslated messages.
Constructor.
Create a new instance of MessageFormat using the messages from the supplied message source.
Format the string. That is, for a particular string find the corresponding translation. Variable subsitution is performed for the $args parameter. A different catalogue can be specified using the $catalogue parameter.
The output charset is determined by $this->getCharset();
Do string translation.
Gets the charset for message output. Default is UTF-8.
Load the message from a particular catalogue. A listed loaded catalogues is kept to prevent reload of the same catalogue. The load catalogue messages are stored in the $this->message array.
Sets the charset for message output.
Set the prefix and suffix to append to untranslated messages.
e.g. $postscript=array('[T]','[/T]'); will output "[T]Hello[/T]" if the translation for "Hello" can not be determined.
Documentation generated on Sun, 04 Jun 2006 18:58:28 -0400 by phpDocumentor 1.3.0RC4