Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
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 modified on July 22, 2026