@@ -4,22 +4,20 @@ A [PEG.js] parser for [ICU MessageFormat] strings – part of [messageformat.js]
44Outputs an AST defined by [ parser.pegjs] .
55
66The generated parser function takes two parameters, first the string to be
7- parsed, and a second optional parameter ` options ` , an object.
8-
9- The options object contains arrays
10- of keywords for ` cardinal ` and ` ordinal ` rules for the current locale – these
11- are used to validate plural and selectordinal keys. If ` options ` or its fields
12- are missing or set to false, the full set of valid [ Unicode CLDR] keys is used:
13- ` 'zero', 'one', 'two', 'few', 'many', 'other' ` . To disable this check, pass in
14- an empty array.
15-
16- The ` options ` object also supports a setting that makes the parser
17- follow the ICU MessageFormat spec more closely: ` strictFunctionParams ` .
18-
19- By default, function parameters are split on commas and trimmed,
20- so the parameters in ` {x,fn, a, b } ` are parsed as ` ['a','b'] ` .
21- Setting ` strictFunctionParams ` to true will result in a params array
22- with a single element: ` [' a, b '] ` .
7+ parsed, and a second optional parameter ` options ` , an object with the following
8+ possible keys:
9+
10+ - ` cardinal ` and ` ordinal ` – Arrays of valid plural categories for the current
11+ locale, used to validate plural and selectordinal keys. If these are missing
12+ or set to false, the full set of valid [ Unicode CLDR] keys is used: `'zero',
13+ 'one', 'two', 'few', 'many', 'other'`. To disable this check, pass in an empty
14+ array.
15+
16+ - ` strictFunctionParams ` – By default, function parameters are split on commas
17+ and trimmed, so the parameters in ` {x,fn, a, b } ` are parsed as
18+ ` ['a','b'] ` . Setting ` strictFunctionParams ` to true will make the parser
19+ follow the ICU MessageFormat spec more closely, and result in a params array
20+ with a single element: ` [' a, b '] ` .
2321
2422[ ICU MessageFormat ] : https://messageformat.github.io/guide/
2523[ messageformat.js ] : https://messageformat.github.io/
0 commit comments