Pluralization with Types
Model plural forms in a type-safe way.
Type-Safe Pluralization
Languages need plural forms: "1 item" vs "2 items". Type-safe i18n models plural categories (like one / other) and requires a count argument so you never forget it.
Plural Categories
The Intl plural rules define categories such as zero, one, two, few, many, other. English uses just one and other; other locales use more.
type PluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";All lessons in this course
- Typing Translation Keys
- Interpolation Type Safety
- Pluralization with Types
- Locale-Aware Type Inference