API

 

LocalizeContext

This interface defines methods to convert values to localized strings.

interface LocalizeContext {
  number( value: number, options: string ): string;
  percent( value: number, options: string ): string;
  currency( value: CurrencyValue, options: string ): string;
  ccy( value: number, currencyCode: string, options: string ): string;
  datetime( value: Date | number | string, options: string ): string;
}

number()

Transforms a number value to a localized text of the number in the active language.

value
The value to convert to localized number string.
options
An optional semicolon separated list of valid number localization parameters. See Number, percent and currency options.

Returns the localized number string.

percent()

Transforms a number value to a localized text of percent in the active language.

value
The value to convert to localized percent string.
options
An optional semicolon separated list of valid percent localization parameters. See Number, percent and currency options.

Returns the localized percent string.

currency()

Transforms a currency value to a localized text of the currency in the active language.

value
The value to convert to localized currency string.
options
An optional semicolon separated list of valid currency localization parameters. See Number, percent and currency options.

Returns the localized currency string.

ccy()

Transforms a number and a currency code to a localized text of the currency in the active language.

value
The value to convert to localized currency string.
currencyCode
The currency code used in the conversion.
options
An optional semicolon separated list of valid currency localization parameters. See Number, percent and currency options.

Returns the localized currency string.

datetime()

Transforms a date value to a localized text of the date in the active language.

value
The value to convert to localized date-time string.
options
An optional semicolon separated list of valid date-time localization parameters. See Date and time formatting.

Returns the localized date-time string.