Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions spec/pluralrules.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Intl.PluralRules ( [ _locales_ [ , _options_ ] ] )</h1>

<emu-alg>
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1. Let _pluralRules_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.PluralRules.prototype%"*, « [[InitializedPluralRules]], [[Locale]], [[Type]], [[Notation]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[RoundingIncrement]], [[RoundingMode]], [[ComputedRoundingPriority]], [[TrailingZeroDisplay]] »).
1. Let _pluralRules_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.PluralRules.prototype%"*, « [[InitializedPluralRules]], [[Locale]], [[Type]], [[Notation]], [[CompactDisplay]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]], [[RoundingIncrement]], [[RoundingMode]], [[ComputedRoundingPriority]], [[TrailingZeroDisplay]] »).
1. Let _optionsResolution_ be ? ResolveOptions(%Intl.PluralRules%, %Intl.PluralRules%.[[LocaleData]], _locales_, _options_, « ~coerce-options~ »).
1. Set _options_ to _optionsResolution_.[[Options]].
1. Let _r_ be _optionsResolution_.[[ResolvedLocale]].
Expand All @@ -28,6 +28,8 @@ <h1>Intl.PluralRules ( [ _locales_ [ , _options_ ] ] )</h1>
1. Set _pluralRules_.[[Type]] to _t_.
1. Let _notation_ be ? GetOption(_options_, *"notation"*, ~string~, « *"standard"*, *"scientific"*, *"engineering"*, *"compact"* », *"standard"*).
1. Set _pluralRules_.[[Notation]] to _notation_.
1. Let _compactDisplay_ be ? GetOption(_options_, *"compactDisplay"*, ~string~, « *"short"*, *"long"* », *"short"*).
1. Set _pluralRules_.[[CompactDisplay]] to _compactDisplay_.
1. Perform ? SetNumberFormatDigitOptions(_pluralRules_, _options_, 0, 3, _notation_).
1. Return _pluralRules_.
</emu-alg>
Expand Down Expand Up @@ -149,6 +151,11 @@ <h1>Intl.PluralRules.prototype.resolvedOptions ( )</h1>
<td>*"notation"*</td>
<td></td>
</tr>
<tr>
<td>[[CompactDisplay]]</td>
<td>*"compactDisplay"*</td>
<td></td>
</tr>
<tr>
<td>[[MinimumIntegerDigits]]</td>
<td>*"minimumIntegerDigits"*</td>
Expand Down Expand Up @@ -252,6 +259,7 @@ <h1>Properties of Intl.PluralRules Instances</h1>
<li>[[Locale]] is a String value with the language tag of the locale whose localization is used by the plural rules.</li>
<li>[[Type]] is one of the String values *"cardinal"* or *"ordinal"*, identifying the plural rules used.</li>
<li>[[Notation]] is one of the String values *"standard"*, *"scientific"*, *"engineering"*, or *"compact"*, identifying the notation used.</li>
<li>[[CompactDisplay]] is one of the String values *"short"* or *"long"*, specifying whether to display compact notation affixes in short form ("5K") or long form ("5 thousand") if formatting with the *"compact"* notation, as this can in some cases influence plural form selection. It is only used when [[Notation]] has the value *"compact"*.</li>
<li>[[MinimumIntegerDigits]] is a non-negative integer indicating the minimum integer digits to be used.</li>
<li>[[MinimumFractionDigits]] and [[MaximumFractionDigits]] are non-negative integers indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary.</li>
<li>[[MinimumSignificantDigits]] and [[MaximumSignificantDigits]] are positive integers indicating the minimum and maximum fraction digits to be used. Either none or both of these properties are present; if they are, they override minimum and maximum integer and fraction digits.</li>
Expand All @@ -272,12 +280,13 @@ <h1>
_locale_: a language tag,
_type_: *"cardinal"* or *"ordinal"*,
_notation_: a String,
_compactDisplay_: *"short"* or *"long"*,
_s_: a decimal String,
): *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, or *"other"*
</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned String characterizes the plural category of _s_ according to _locale_, _type_, and _notation_.</dd>
<dd>The returned String characterizes the plural category of _s_ according to _type_, _notation_, and _compactDisplay_ for the corresponding _locale_.</dd>
</dl>
</emu-clause>

Expand All @@ -301,24 +310,26 @@ <h1>
1. Let _locale_ be _pluralRules_.[[Locale]].
1. Let _type_ be _pluralRules_.[[Type]].
1. Let _notation_ be _pluralRules_.[[Notation]].
1. Let _p_ be PluralRuleSelect(_locale_, _type_, _notation_, _s_).
1. Let _compactDisplay_ be _pluralRules_.[[CompactDisplay]].
1. Let _p_ be PluralRuleSelect(_locale_, _type_, _notation_, _compactDisplay_, _s_).
1. Return the Record { [[PluralCategory]]: _p_, [[FormattedString]]: _s_ }.
</emu-alg>
</emu-clause>

<emu-clause id="sec-pluralruleselectrange" type="implementation-defined abstract operation">
<h1>
PluralRuleSelectRange (
_locale_: a String,
_locale_: a language tag,
_type_: *"cardinal"* or *"ordinal"*,
_notation_: a String,
_compactDisplay_: *"short"* or *"long"*,
_xp_: *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, or *"other"*,
_yp_: *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, or *"other"*,
): *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, or *"other"*
</h1>
<dl class="header">
<dt>description</dt>
<dd>It performs an implementation-dependent algorithm to map the <emu-xref href="#sec-pluralruleselect">plural category</emu-xref> String values _xp_ and _yp_, respectively characterizing the start and end of a range, to a resolved String value for the plural form of the range as a whole denoted by _type_ and _notation_ for the corresponding _locale_, or the String value *"other"*.</dd>
<dd>It performs an implementation-dependent algorithm to map the <emu-xref href="#sec-pluralruleselect">plural category</emu-xref> String values _xp_ and _yp_, respectively characterizing the start and end of a range, to a resolved String value for the plural form of the range as a whole denoted by _type_, _notation_, and _compactDisplay_ for the corresponding _locale_, or the String value *"other"*.</dd>
</dl>
</emu-clause>

Expand All @@ -343,7 +354,8 @@ <h1>
1. Let _locale_ be _pluralRules_.[[Locale]].
1. Let _type_ be _pluralRules_.[[Type]].
1. Let _notation_ be _pluralRules_.[[Notation]].
1. Return PluralRuleSelectRange(_locale_, _type_, _notation_, _xp_.[[PluralCategory]], _yp_.[[PluralCategory]]).
1. Let _compactDisplay_ be _pluralRules_.[[CompactDisplay]].
1. Return PluralRuleSelectRange(_locale_, _type_, _notation_, _compactDisplay_, _xp_.[[PluralCategory]], _yp_.[[PluralCategory]]).
</emu-alg>
</emu-clause>
</emu-clause>
Expand Down