ParseOptions.strict property

By default, the parsing applies a few relaxations to the ICU MessageFormat spec. Setting strict: true will disable these relaxations.

Signature:

strict?: boolean;

Remarks

  • The argType of simpleArg formatting functions will be restricted to the set of number, date, time, spellout, ordinal, and duration, rather than accepting any lower-case identifier that does not start with a number.

  • The optional argStyle of simpleArg formatting functions will not be parsed as any other text, but instead as the spec requires: “In argStyleText, every single ASCII apostrophe begins and ends quoted literal text, and unquoted {curly braces} must occur in matched pairs.”

  • Inside a plural or selectordinal statement, a pound symbol (#) is replaced with the input number. By default, # is also parsed as a special character in nested statements too, and can be escaped using apostrophes ('#'). In strict mode # will be parsed as a special character only directly inside a plural or selectordinal statement. Outside those, # and '#' will be parsed as literal text.