-
Notifications
You must be signed in to change notification settings - Fork 107
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
Define sort order of "pluralCategories" array #578
Comments
This should be a small normative PR, since it reflects web reality. |
My preference if I were to ignore web reality would be to order them the way UTS 35 does: <!ATTLIST pluralRule count (zero | one | two | few | many | other) #REQUIRED > |
Can we do that? I really like that idea, if we can choose to ignore web reality... |
The set of six plural forms could grow in the future (unlikely but possible). I think ICU prefers sorting alphabetically because it's predictable and algorithmic. If you have a custom sort order, then you need to have a special code path. My preference is to reflect web reality instead of introducing a special case sort order. |
Alphabetic is a developer paper cut - it makes API clearly return "one" before "zero" while semantically the incremental order relation to numerical values is reverse. It's an artifact of how latin alphabet is sorted and how categories are named in latin alphabet, and should not be impacting the API itself. The ICU4C behavior seems like optimal for API implementation author, not API user, which I believe is the wrong API design model. I also don't see it as risk that if we'll change categories, we'll return different set. I see it as 0/10 importance. The order being semantically valid is 3/10 for me. |
|
Why wouldn't it be useful to depend on? Deterministic ordering is always useful. |
The main reason to deterministically order, is to make it impossible for sites to inadvertently depend on implementation-specific behavior. No more and no less. I doubt any existing code depends on the ordering, myself. At worst it's not more than extremely few (one or two) users. Aesthetically I like the zero/one/two/etc. ordering. But this is for programmatic consumption. It's not unreasonable to say that users (e.g. UIs) who need the aesthetic ordering can postprocess accordingly. And implementations (save the polyfill) ship alphabetical already. So it's not a strong preference, but if this is just a set, and using a literal |
2021-07-01 discussion: https://github.com/tc39/ecma402/blob/master/meetings/notes-2021-07-01.md#define-sort-order-of-pluralcategories-array-578 We spent time discussing this issue, but did not reach a conclusion. I would characterize the conversation as generally in favor of specifying an order, but split about 50/50 on whether to do lexicographical order (web reality) or UTS-35 order. I personally am in the lexicographic camp because:
The next step for whoever takes this issue is to work with the relevant parties offline to find a middle ground that everyone can agree on. |
This is NOT true. Lexicographic ordering is NOT web reality for the return value of this API in the last 5 - 7 years of reality. chrome 91 / FireFox 89 and Safari Version 14.1.1 (16611.2.7.1.4) on my Mac ALL return the same as below, NOT in lexicographic ordering: (new Intl.PluralRules("ar")).resolvedOptions().pluralCategories (new Intl.PluralRules("he")).resolvedOptions().pluralCategories (new Intl.PluralRules("sl")).resolvedOptions().pluralCategories (new Intl.PluralRules("ru")).resolvedOptions().pluralCategories (new Intl.PluralRules("se")).resolvedOptions().pluralCategories (new Intl.PluralRules("cy")).resolvedOptions().pluralCategories (new Intl.PluralRules("br")).resolvedOptions().pluralCategories If we need to define an order, I propose we define it as the current web reality, in the following order |
Response:
Zibi's position
That single identified use case (GUI CAT tool) benefits from the ordering
|
I will be raising this question tomorrow morning at TC39. Slides: https://docs.google.com/presentation/d/1tDvpl99axNaZQWm1VItYhztMMj3avV8jc8uvvXQLRI4/edit#slide=id.p |
We should do the following:
Note that this should comprise 2 PRs, one editorial in the style guide, and the other normative for PluralRules. |
@ben-allen to make the second PR for the PluralRules. |
Intl.PluralRules.prototype.resolvedOptions ( ) should define the sort order of the "pluralCategories" array, e.g.
["one", "zero"]
or["zero", "one"]
. ICU (and therefore all browsers) return the array in alphabetical order, i.e.["few", "many" "one", "other", "two", "zero"]
.The text was updated successfully, but these errors were encountered: