Skip to content

Commit 3ed0972

Browse files
eemeliaphillips
andauthored
Add a <matchSignature> for :number, together with :ordinal & :plural aliases (#560)
* Add a <matchSignature> for :number, together with :ordinal & :plural aliases * Apply suggestions from code review Co-authored-by: Addison Phillips <[email protected]> --------- Co-authored-by: Addison Phillips <[email protected]>
1 parent eaedcff commit 3ed0972

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

spec/registry.xml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<function name="number">
148148
<!-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat -->
149149
<description>
150-
Locale-sensitive number formatting
150+
Number selection and formatting
151151
</description>
152152

153153
<formatSignature>
@@ -249,11 +249,73 @@
249249
</option>
250250
</formatSignature>
251251

252+
<matchSignature>
253+
<input validationRule="anyNumber"/>
254+
<option name="select" values="plural ordinal exact" default="plural">
255+
<description>
256+
The number selection type.
257+
258+
One of three selection models for numeric values, defaulting to "plural".
259+
260+
Each selector type matches numeric values to keys using the "number-literal"
261+
production from the ABNF.
262+
The "plural" and "ordinal" selectors also use plural or ordinal rules from CLDR
263+
to match categories "zero", "one", "two", "few", "many" and "other" with a lower
264+
match quality than exact numeric match.
265+
</description>
266+
</option>
267+
<option name="minimumIntegerDigits" values="positiveInteger" default="1">
268+
<description>
269+
The minimum number of integer digits to use.
270+
A value with a smaller number of integer digits than this number will be
271+
left-padded with zeros (to the specified length) when formatted.
272+
</description>
273+
</option>
274+
<option name="minimumFractionDigits" values="positiveInteger">
275+
<description>
276+
The minimum number of fraction digits to use.
277+
The default for plain number and percent formatting is 0;
278+
the default for currency formatting is the number of minor unit digits provided by
279+
the ISO 4217 currency code list (2 if the list doesn't provide that information).
280+
</description>
281+
</option>
282+
<option name="maximumFractionDigits" values="positiveInteger">
283+
<description>
284+
The maximum number of fraction digits to use.
285+
The default for plain number formatting is the larger of minimumFractionDigits and 3;
286+
the default for currency formatting is the larger of minimumFractionDigits and the number of minor
287+
unit digits provided by the ISO 4217 currency code list (2 if the list doesn't provide that information);
288+
the default for percent formatting is the larger of minimumFractionDigits and 0.
289+
</description>
290+
</option>
291+
<option name="minimumSignificantDigits" values="positiveInteger" default="1">
292+
<description>
293+
The minimum number of significant digits to use.
294+
</description>
295+
</option>
296+
<option name="maximumSignificantDigits" values="positiveInteger" default="21">
297+
<description>
298+
The maximum number of significant digits to use.
299+
</description>
300+
</option>
301+
<match validationRule="anyNumber" values="zero one two few many other" />
302+
</matchSignature>
303+
252304
<alias name="integer">
253-
<description>Locale-sensitive integral number formatting</description>
305+
<description>Integer selection and formatting</description>
254306
<setOption name="maximumFractionDigits" value="0" />
255307
<setOption name="style" value="decimal" />
256308
</alias>
309+
310+
<alias name="ordinal" supports="match">
311+
<description>Ordinal number selection</description>
312+
<setOption name="select" value="ordinal" />
313+
</alias>
314+
315+
<alias name="plural" supports="match">
316+
<description>Plural number selection</description>
317+
<setOption name="select" value="plural" />
318+
</alias>
257319
</function>
258320

259321
<function name="string">

0 commit comments

Comments
 (0)