as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

MessageFormatClassic

The 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.

Constructors

new MessageFormatClassic()

new MessageFormatClassic(): MessageFormatClassic

Returns

MessageFormatClassic

Methods

format()

static format(pattern: string, args: Map<string, string | number | Date>): string | null

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. Formatted message on success, null on failure.

Returns

string | null


formatPositional()

static formatPositional(pattern: string, args?: (string | number | Date)[]): string | null

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 Formatted message on success, null on failure.

Returns

string | null


formatPositionalWithLocale()

static formatPositionalWithLocale(pattern: string, locale: string | null, args?: (string | number | Date)[]): string | null

Formats the specified pattern with numbered arguments in the specified locale.

Parameters

pattern

string

A classic message format pattern.

locale

string | null

A BCP-47 locale string. If this parameter is null or an empty string, the default locale is used.

args?

(string | number | Date)[]

Array of argument values Formatted message on success, null on failure.

Returns

string | null


formatWithLocale()

static formatWithLocale(pattern: string, locale: string | null, args: Map<string, string | number | Date>): string | null

Formats the specified pattern with named arguments in the specified locale.

Parameters

pattern

string

A classic message format pattern.

locale

string | null

A BCP-47 locale string. If this parameter is null or an empty string, the default locale is used.

args

Map<string, string | number | Date>

Map of argument names to their values. Formatted message on success, null on failure.

Returns

string | null


getMajorVersion()

static getMajorVersion(): number

Gets the major version number. Major version number.

Returns

number


getMinorVersion()

static getMinorVersion(): number

Gets the minor version number. Minor version number.

Returns

number


getPatchVersion()

static getPatchVersion(): number

Gets the patch version number. Patch version number.

Returns

number


Last updated: Jul 22, 2026