feat(@formatjs/intl-pluralrules): support notation/compactDisplay (c/e operands)#5914
Closed
longlho wants to merge 1 commit intographite-base/5914from
Conversation
This was referenced Jan 15, 2026
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. |
f867d7d to
a7ff231
Compare
a7ff231 to
930922b
Compare
Merge activity
|
graphite-app Bot
pushed a commit
that referenced
this pull request
Jan 15, 2026
…e operands) (#5914) ### TL;DR Add support for compact notation in `Intl.PluralRules` with the `c/e` operand for languages that use exponent-based plural rules. ### What changed? - Added `notation` and `compactDisplay` options to `Intl.PluralRules` to support compact notation - Updated the `GetOperands` function to include the `CompactExponent` operand - Modified the plural rules compiler to pass the exponent parameter to plural functions - Added support for calculating compact exponents using NumberFormat locale data - Updated type definitions and interfaces to support the new parameters - Added tests for compact notation with various locales ### How to test? 1. Create a PluralRules instance with compact notation: ```js const pr = new Intl.PluralRules('fr', {notation: 'compact'}); pr.select(1000000); // Should return 'many' for French ``` 2. Test with different locales that use compact notation rules: ```js const locales = ['ca', 'es', 'fr', 'it', 'pt', 'pt-PT']; for (const locale of locales) { const pr = new Intl.PluralRules(locale, {notation: 'compact'}); console.log(locale, pr.select(1000000)); } ``` 3. Compare compact vs standard notation: ```js const prCompact = new Intl.PluralRules('fr', {notation: 'compact'}); const prStandard = new Intl.PluralRules('fr'); console.log(prCompact.select(1200000), prStandard.select(1200000)); ``` ### Why make this change? Several languages (including French, Spanish, Italian, Portuguese, and Catalan) have plural rules that depend on the compact notation exponent. For example, in French, numbers formatted in millions use a different plural form than the same numbers in standard notation. This change enables correct plural selection for compact-formatted numbers in these languages, which is essential for proper localization of applications that use compact number formatting alongside pluralization.
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 support for compact notation in
Intl.PluralRuleswith thec/eoperand for languages that use exponent-based plural rules.What changed?
notationandcompactDisplayoptions toIntl.PluralRulesto support compact notationGetOperandsfunction to include theCompactExponentoperandHow to test?
Why make this change?
Several languages (including French, Spanish, Italian, Portuguese, and Catalan) have plural rules that depend on the compact notation exponent. For example, in French, numbers formatted in millions use a different plural form than the same numbers in standard notation.
This change enables correct plural selection for compact-formatted numbers in these languages, which is essential for proper localization of applications that use compact number formatting alongside pluralization.