For AI agents: the complete documentation index is available at /tc39-atlas/en/llms.txt, the full documentation bundle is available at /tc39-atlas/en/llms-full.txt, and this page is available as Markdown at /tc39-atlas/en/proposals/proposal-intl-plural-rules.md.
  • English
  • Intl.PluralRules S4

    Proposal details
    Proposal overview

    This proposal introduces a new API Intl.PluralRules to select the appropriate plural category for a given number based on locale and type (cardinal or ordinal). The proposal also supports ordinal plurals and specifies the pluralCategories resolution.

    Note

    The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.

    Intl.PluralRules API Specification [draft]

    Status

    Current Stage:

    • Stage 4

    Implementation Progress:

    Explainer:

    Spec Text:

    Authors

    • Caridy Patiño (@caridy)
    • Eric Ferraiuolo (@ericf)
    • Alex Sexton (@SlexAxton)

    Reviewers

    • Daniel Ehrenberg (@littledan)
    • Stefan Penner (@stefanpenner)

    Informative

    This proposal is based on the LDML spec, C.11 Language Plural Rules:

    Prior Art

    • Java: Class PluralRules

    Usage

    let o = new Intl.PluralRules("en", {
        type: "cardinal" // default type
    });
    console.log(o.select(0)); // "other"
    console.log(o.select(1)); // "one"
    console.log(o.select(2)); // "other"

    Support for ordinals is also included:

    let o = new Intl.PluralRules("en", {
        type: "ordinal"
    });
    console.log(o.select(21)); // "one"
    console.log(o.select(22)); // "two"
    console.log(o.select(23)); // "few"
    console.log(o.select(24)); // "other"

    TODO

    • new Intl.PluralRules("en").format(1.02); should produce "other"
    • Bikeshed on Intl.PluralRules
    • Spec pluralCategories resolution

    Render Spec

    npm install
    npm run build
    open index.html

    Backpointers