Back to index

php5  5.3.10
Public Member Functions | Static Public Member Functions
MessageFormatter Class Reference

Message formatter class. More...

List of all members.

Public Member Functions

 __construct ($locale, $pattern)
 Constructs a new Message Formatter.
 format ($args)
 Format the message.
 parse ($value)
 Parse input string and returns any extracted items as an array.
 getPattern ()
 Get the pattern used by the formatter.
 setPattern ($pattern)
 Set the pattern used by the formatter.
 getErrorCode ()
 Get the error code from last operation.
 getErrorMessage ()
 Get the error text from the last operation.
 getLocale ()
 Get the locale for which the formatter was created.

Static Public Member Functions

static create ($locale, $pattern)
 Constructs a new Message Formatter.
static formatMessage ($locale, $pattern, $args)
 Inserts the items in $args into $pattern, formatting them according to $locale.
static parseMessage ($locale, $value)
 parses input string and returns any extracted items as an array

Detailed Description

Message formatter class.

Message Format provides for runtime formatting of messages in a manner somewhat similar to sprintf. The pattern string has its component parts replaced in a locale-sensitive manner using items in the arguments array.

See also:
http://www.icu-project.org/apiref/icu4c/umsg_8h.html

Definition at line 13 of file msgfmt_api.php.


Constructor & Destructor Documentation

MessageFormatter::__construct ( locale,
pattern 
)

Constructs a new Message Formatter.

Parameters:
string$localethe locale to use when formatting arguments
string$patternthe pattern string to stick arguments into

Definition at line 21 of file msgfmt_api.php.

{}

Member Function Documentation

static MessageFormatter::create ( locale,
pattern 
) [static]

Constructs a new Message Formatter.

Parameters:
string$localethe locale to use when formatting arguments
string$patternthe pattern string to stick arguments into

Definition at line 29 of file msgfmt_api.php.

{}

Here is the caller graph for this function:

Format the message.

Parameters:
array$argsarguments to insert into the pattern string
Returns:
string the formatted string, or false if an error ocurred

Definition at line 36 of file msgfmt_api.php.

{}
static MessageFormatter::formatMessage ( locale,
pattern,
args 
) [static]

Inserts the items in $args into $pattern, formatting them according to $locale.

This is the static implementation.

Parameters:
string$localethe locale to use when formatting numbers and dates and suchlike
string$patternthe pattern string to insert things into
array$argsthe array of values to insert into $pattern
Returns:
string the formatted pattern string or false if an error occured

Definition at line 59 of file msgfmt_api.php.

{}

Here is the caller graph for this function:

Get the error code from last operation.

Returns error code from the last number formatting operation.

Returns:
integer the error code, one of UErrorCode values. Initial value is U_ZERO_ERROR.

Definition at line 96 of file msgfmt_api.php.

{}

Get the error text from the last operation.

Returns:
string Description of the last error.

Definition at line 102 of file msgfmt_api.php.

{}

Get the locale for which the formatter was created.

Returns:
string locale name

Definition at line 108 of file msgfmt_api.php.

{}

Get the pattern used by the formatter.

Returns:
string the pattern string for this message formatter

Definition at line 79 of file msgfmt_api.php.

{}

Parse input string and returns any extracted items as an array.

$error will contain any error code. If an error occurs, $parse_pos contains the position of the error.

Parameters:
string$valuestring to parse for items
Returns:
array array containing items extracted

Definition at line 48 of file msgfmt_api.php.

{}
static MessageFormatter::parseMessage ( locale,
value 
) [static]

parses input string and returns any extracted items as an array

$error will contain any error code. If an error occurs, $parse_pos contains the position of the error.

Parameters:
string$localethe locale to use when formatting numbers and dates and suchlike
string$valuestring to parse for items
Returns:
array array containing items extracted

Definition at line 72 of file msgfmt_api.php.

{}

Here is the caller graph for this function:

Set the pattern used by the formatter.

Parameters:
string$patternthe pattern string to use in this message formatter
Returns:
boolean 'true' if successful, 'false' if an error

Definition at line 87 of file msgfmt_api.php.

{}

The documentation for this class was generated from the following file: