Skip to content

Instantly share code, notes, and snippets.

@goofballLogic
Created October 28, 2021 17:06
Show Gist options
  • Save goofballLogic/48c1475eca91281274b651c8bb498680 to your computer and use it in GitHub Desktop.
Save goofballLogic/48c1475eca91281274b651c8bb498680 to your computer and use it in GitHub Desktop.
const cardinalPluralRules = new Intl.PluralRules("en");
cardinalPluralRules.select(0) // other
cardinalPluralRules.select(1) // one
cardinalPluralRules.select(2) // other
cardinalPluralRules.select(3) // other
cardinalPluralRules.select(4) // other
const ordinalPluralRules = new Intl.PluralRules("en", { type: "ordinal" });
ordinalPluralRules.select(0) // other
ordinalPluralRules.select(1) // one
ordinalPluralRules.select(2) // two
ordinalPluralRules.select(3) // few
ordinalPluralRules.select(4) // other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment