Repository navigation
Conversation
This was referenced Jan 15, 2026
longlho
marked this pull request as ready for review
January 15, 2026 04:13
This was referenced Jan 15, 2026
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
graphite-app
Bot
changed the base branch from
01-14-feat_formatjs_intl-pluralrules_remove_make-plural-compiler_add_support_for_huge_numbers
to
graphite-base/5913
January 15, 2026 04:23
longlho
force-pushed
the
graphite-base/5913
branch
from
January 15, 2026 04:23
e933aa8 to
bed7271
Compare
longlho
force-pushed
the
01-14-feat_formatjs_intl-pluralrules_support_selectrange
branch
from
January 15, 2026 04:23
8d69cd6 to
b857c77
Compare
Merge activity
|
longlho
force-pushed
the
01-14-feat_formatjs_intl-pluralrules_support_selectrange
branch
from
January 15, 2026 04:41
b857c77 to
bf702c4
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
Jan 15, 2026
### TL;DR
Add `selectRange` method to `Intl.PluralRules` to support plural forms for number ranges.
### What changed?
- Implemented the `selectRange(start, end)` method for `Intl.PluralRules` according to the ECMA-402 specification
- Added support for CLDR plural range data to determine the correct plural form for ranges
- Created new abstract operations `ResolvePluralInternal` and `ResolvePluralRange`
- Added ICU4J conformance tests to validate the implementation behavior
- Enhanced type definitions to support plural ranges data
- Updated CLDR data extraction to include plural range rules
### How to test?
- Run the ICU4J conformance tests to verify behavior matches the reference implementation
- Test with different locales that have distinct plural range rules:
```js
const prEn = new Intl.PluralRules('en');
prEn.selectRange(1, 2); // "other" (English: "1-2 items")
prEn.selectRange(1, 1); // "one" (same value: "1 item")
const prFr = new Intl.PluralRules('fr');
prFr.selectRange(0, 1); // "one" (French: "0-1 vue")
prFr.selectRange(1, 2); // "other" (French: "1-2 vues")
```
- Verify BigInt support works correctly (unlike Chrome's native implementation)
### Why make this change?
The `selectRange` method is part of the ECMA-402 specification but was missing from our implementation. This method is essential for correctly formatting phrases with number ranges in different languages, where plural rules for ranges can be complex. For example, in English "1-2 items" uses the "other" form, while in French "0-1 vue" uses the "one" form.
This implementation follows the spec by returning the start category when the formatted strings are identical, and otherwise consulting locale-specific plural range data from CLDR. The ICU4J conformance tests confirm our implementation matches the reference behavior.
graphite-app
Bot
deleted the
01-14-feat_formatjs_intl-pluralrules_support_selectrange
branch
January 15, 2026 05:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Add
selectRangemethod toIntl.PluralRulesto support plural forms for number ranges.What changed?
selectRange(start, end)method forIntl.PluralRulesaccording to the ECMA-402 specificationResolvePluralInternalandResolvePluralRangeHow to test?
Why make this change?
The
selectRangemethod is part of the ECMA-402 specification but was missing from our implementation. This method is essential for correctly formatting phrases with number ranges in different languages, where plural rules for ranges can be complex. For example, in English "1-2 items" uses the "other" form, while in French "0-1 vue" uses the "one" form.This implementation follows the spec by returning the start category when the formatted strings are identical, and otherwise consulting locale-specific plural range data from CLDR. The ICU4J conformance tests confirm our implementation matches the reference behavior.