MessageFormatClassic API adopts the classic ICU MessageFormat patterns for formatting messages.
The
MessageFormatClassic API supports both named-argument style and numbered-argument style in patterns.
Use the named-argument style to improve readability for developers and translators by providing descriptively
named arguments. In addition, that can better infer what kind of values go into the arguments in a pattern.
Examples
Constructors
new MessageFormatClassic()
new MessageFormatClassic():MessageFormatClassic
Returns
MessageFormatClassic
Methods
format()
static format(pattern, args): null | string
Formats the specified pattern with named arguments in the default locale.
Parameters
pattern
string
A classic message format pattern.
args
Map<string, string | number | Date>
Map of argument names to their values.
Returns
null | string
Formatted message on success, null on failure.
formatPositional()
static formatPositional(pattern, …args): null | string
Formats the specified pattern with numbered arguments in the default locale.
Parameters
pattern
string
A classic message format pattern.
args
…(string | number | Date)[]
Array of argument values
Returns
null | string
Formatted message on success, null on failure.

