-
Notifications
You must be signed in to change notification settings - Fork 111
Normative: Add [[CompactDisplay]] slot to Intl.PluralRules #1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR allows implementations to take into account potential differences between the short compact form ("5K") and long form ("5 thousand") when determining the correct plural form to use.
note: the potentially controversial decision here is to have |
spec/pluralrules.html
Outdated
PluralRuleSelect ( | ||
_locale_: a language tag, | ||
_type_: *"cardinal"* or *"ordinal"*, | ||
_notation_: a String, | ||
_pluralRules_: an Intl.PluralRules, | ||
_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 the effective locale and the internal slots of _pluralRules_: [[Type]], one of the String values *"cardinal"* or *"ordinal"*, [[Notation]], specifying the notation used, and [[CompactDisplay]], specifying whether compact notation affixes are to be displayed in short form or long form.</dd> | ||
</dl> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are implementations allowed to use other slots of the Intl.PluralRules instance? A significant benefit of narrowly constraining parameters for implementation-defined abstract operations is that it makes clear what details must not affect their behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The headers specify the slots of _pluralRules_
that are used. Is that sufficient to properly restrict slot usage, or is it necessary to restrict them via the parameters list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to do so via parameters, and if those ever get too excessive I'd advocate for introducing a new specialized record type (which here would be something like a Plural Rule Selector Record { [[Type]]: *"cardinal"* or *"ordinal"*, [[Notation]]: a string, [[CompactDisplay]]: *"short"* or *"long"* }
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed an update restoring the original parameters + the _compactDisplay_
parameter.
additionally: made the assignment to _pluralRules_.[[CompactDisplay]]
in the PluralRules
constructor non-conditional, since (correct me if I'm wrong) there's no reason not to just let it be *"short"*
when using non-compact notations.
Co-authored-by: Richard Gibson <[email protected]>
…move conditional when setting _pluralRules_.[[CompactDisplay]]
3357fc0
to
c85b34b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR allows implementations to take into account potential differences between the short compact form ("5K") and long form ("5 thousand") when determining the correct plural form to use.
Fixes: #1013