@@ -413,6 +413,124 @@ contains an implementation-defined currency value
413
413
of the _operand_ of the annotated _expression_,
414
414
together with the resolved options' values.
415
415
416
+ #### The `:percent` function
417
+
418
+ > [!IMPORTANT]
419
+ > The _function_ `:percent` has a status of **Draft**.
420
+ > It is proposed for inclusion in a future release of this specification and is not Stable.
421
+
422
+ The function `:percent` is a selector and formatter for percent values.
423
+
424
+ ##### `:percent` Operands
425
+
426
+ The function `:percent` requires a _numeric operand_ as its _operand_.
427
+
428
+ When either selecting or formatting the _expression_,
429
+ the numeric value of the _operand_ is multiplied by 100.
430
+
431
+ ##### `:percent` Options
432
+
433
+ Some options do not have default values defined in this specification.
434
+ The defaults for these options are implementation-dependent.
435
+ In general, the default values for such options depend on the locale,
436
+ the value of other options, or both.
437
+
438
+ > [!NOTE]
439
+ > The names of _options_ and their _option values_ were derived from the
440
+ > [options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options)
441
+ > in JavaScript's `Intl.NumberFormat`.
442
+
443
+ The following _options_ are REQUIRED to be available on the function `:percent`:
444
+
445
+ - `signDisplay`
446
+ - `auto` (default)
447
+ - `always`
448
+ - `exceptZero`
449
+ - `negative`
450
+ - `never`
451
+ - `useGrouping`
452
+ - `auto` (default)
453
+ - `always`
454
+ - `never`
455
+ - `min2`
456
+ - `minimumFractionDigits`
457
+ - _digit size option_, default: `0`
458
+ - `maximumFractionDigits`
459
+ - _digit size option_, default: `0`
460
+ - `minimumSignificantDigits`
461
+ - _digit size option_
462
+ - `maximumSignificantDigits`
463
+ - _digit size option_
464
+ - `trailingZeroDisplay`
465
+ - `auto` (default)
466
+ - `stripIfInteger`
467
+ - `roundingPriority`
468
+ - `auto` (default)
469
+ - `morePrecision`
470
+ - `lessPrecision`
471
+ - `roundingMode`
472
+ - `ceil`
473
+ - `floor`
474
+ - `expand`
475
+ - `trunc`
476
+ - `halfCeil`
477
+ - `halfFloor`
478
+ - `halfExpand` (default)
479
+ - `halfTrunc`
480
+ - `halfEven`
481
+
482
+ The numeric value of the _operand_ is multiplied by 100
483
+ at the start of formatting or selection.
484
+ Each _option_ is applied to the formatted (or selected) value
485
+ rather than the unaltered value of the _operand_.
486
+
487
+ > For example, this _placeholder_:
488
+ >
489
+ > ```
490
+ > {0.1234 :percent maximumFractionDigits=1}
491
+ > ```
492
+ >
493
+ > might be formatted as "12.3%" in an English locale.
494
+
495
+ If the _operand_ of the _expression_ is an implementation-defined type,
496
+ such as the _resolved value_ of an _expression_ with a `:number` or `:integer` _annotation_,
497
+ it can include option values.
498
+ In general, these are included in the resolved option values of the _expression_,
499
+ with _options_ on the _expression_ taking priority over any options of the _operand_.
500
+ Options with the following names are however discarded if included in the _operand_:
501
+
502
+ - `minimumIntegerDigits`
503
+ - `roundingIncrement`
504
+ - `select`
505
+
506
+ ##### `:percent` Resolved Value
507
+
508
+ The _resolved value_ of an _expression_ with a `:percent` _function_
509
+ contains an implementation-defined numerical value
510
+ of the _operand_ of the annotated _expression_
511
+ together with the resolved options' values.
512
+ The numerical value of the _resolved value_ of the _expression_
513
+ is the same as the numerical value of its _operand_;
514
+ it is not multiplied by 100.
515
+
516
+ ##### Selection with `:percent`
517
+
518
+ The _function_ `:percent` performs selection as described in [Number Selection](#number-selection) below.
519
+ This selection always uses the `plural` selection mode,
520
+ and is performed on the numerical value of the _operand_
521
+ multiplied by 100.
522
+
523
+ > For example, this _message_:
524
+ > ```
525
+ > .local $pct = {1 :percent}
526
+ > .match $pct
527
+ > 1 {{Would match with 0.01 as the operand}}
528
+ > 100 {{Matches 💯}}
529
+ > * {{Otherwise}}
530
+ > ```
531
+ >
532
+ > would be formatted as "Matches 💯".
533
+
416
534
#### The `:unit` function
417
535
418
536
> [!IMPORTANT]
0 commit comments