Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 3.45 KB

File metadata and controls

34 lines (24 loc) · 3.45 KB
title MessageFormatOptions
parent @messageformat/core
grand_parent API Reference

MessageFormatOptions interface

Options for the MessageFormat constructor

Signature:

export interface MessageFormatOptions<ReturnType extends 'string' | 'values' = 'string' | 'values'> 

Properties

Property Modifiers Type Description
biDiSupport? boolean

(Optional) Add Unicode control characters to all input parts to preserve the integrity of the output when mixing LTR and RTL text

Default: false

currency? string

(Optional) The currency to use when formatting {V, number, currency}

Default: USD

customFormatters? { [key: string]: CustomFormatter | { formatter: CustomFormatter; arg?: 'string' | 'raw' | 'options'; id?: string; module?: string | ((locale: string) => string); }; } (Optional) Map of custom formatting functions to include. See Custom Formatters for more details.
localeCodeFromKey? ((key: string) => string | null | undefined) | null

(Optional) If defined, used by compileModule() to identify and map keys to the locale identifiers used by formatters and plural rules. The values returned by the function should match the locale argument.

Default: undefined

requireAllArguments? boolean

(Optional) Require all message arguments to be set with a defined value

Default: false

returnType? ReturnType

(Optional) Return type of compiled functions; either a concatenated 'string' or an array (possibly hierarchical) of 'values'.

Default: 'string'

strict? boolean

(Optional) Follow the ICU MessageFormat spec more closely, but not allowing custom formatters and by allowing# only directly within a plural or selectordinal case, rather than in any inner select case as well. See the parser option for more details.

Default: false

strictPluralKeys? boolean

(Optional) Enable strict checks for plural keys according to Unicode CLDR. When set to false, the compiler will also accept any invalid plural keys. Also see the corresponding parser option.

Default: true

timeZone? string

(Optional) The time zone to use when formatting {V, date} instead of current machine time zone. Defaults to current machine time zone.

Default: undefined