Method Summary
-
string
format($string, $args = array(), $catalogue = null, $charset = null)
Formats 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.
-
string
formatString($string, $args = array(), $catalogue = null)
Do string translation.
-
string
getCharset()
Gets the charset for message output. Default is UTF-8.
-
MessageSource
getSource()
Gets the message source.
-
loadCatalogue($catalogue)
Loads 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.
-
replaceArgs($string, $args)
-
setCharset($charset)
Sets the charset for message output.
-
setUntranslatedPS($postscript)
Sets the prefix and suffix to append to untranslated messages.
-
__construct($source, $charset = 'UTF-8')
Constructor.
Method Details
-
(string) format ($string, $args = array(), $catalogue = null, $charset = null)
Browse code
| $string |
the string to translate.
|
| $args |
a list of string to substitute.
|
| $catalogue |
get the translation from a particular message
|
| $charset |
charset, the input AND output charset catalogue.
|
Formats 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();
returns translated string.
-
(string) formatString ($string, $args = array(), $catalogue = null)
Browse code
| $string |
the string to translate.
|
| $args |
a list of string to substitute.
|
| $catalogue |
get the translation from a particular message catalogue.
|
Do string translation.
returns translated string.
-
(string) getCharset ()
Browse code
Gets the charset for message output. Default is UTF-8.
returns charset, default UTF-8
-
(MessageSource) getSource ()
Browse code
Gets the message source.
-
loadCatalogue ($catalogue)
Browse code
| $catalogue |
message catalogue to load.
|
Loads 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.
-
replaceArgs ($string, $args)
Browse code
-
| $charset |
charset, default is UTF-8
|
Sets the charset for message output.
-
setUntranslatedPS ($postscript)
Browse code
| $postscript |
first element is the prefix, second element the suffix.
|
Sets 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.
-
__construct ($source, $charset = 'UTF-8')
Browse code
| $source |
the source of translation messages.
|
| $charset |
for the message output.
|
Constructor.
Create a new instance of sfMessageFormat using the messages from the supplied message source.
|