i18next v4

The i18next v4 plural format

The modern i18next convention names things properly: one key per CLDR category, spelled into the suffix. item_one, item_few, item_many, item_other: the file reads like the rule it follows, any tool can see which form is which, and the library resolves the count through the same category names the suffix carries.

This page covers the convention, the 2021 switch that produced it, and the same plural in JSON, YAML and properties.

Examples

The same plural, three languages

The key set grows exactly as CLDR demands: two keys for English, four for Polish, six for Arabic, each self describing.

en · two keys
"item_one": "{{count}} item",
"item_other": "{{count}} items"
pl · four keys
"item_one": "{{count}} artykuł",
"item_few": "{{count}} artykuły",
"item_many": "{{count}} artykułów",
"item_other": "{{count}} artykułu"
ar · six keys
"item_zero": "لا عناصر",
"item_one": "عنصر واحد",
"item_two": "عنصران",
"item_few": "{{count}} عناصر",
"item_many": "{{count}} عنصرًا",
"item_other": "{{count}} عنصر"
en
item_one: "{{count}} item"
item_other: "{{count}} items"
pl
item_one: "{{count}} artykuł"
item_few: "{{count}} artykuły"
item_many: "{{count}} artykułów"
item_other: "{{count}} artykułu"
en
item_one={{count}} item
item_other={{count}} items

How it works

Intl.PluralRules does the counting

The library asks the browser’s Intl.PluralRules which category the count belongs to and appends it to the key. No rule tables ship in the app and no positions need decoding; the platform knows CLDR, and the file speaks the same names. Context variants compose the same way (friend_male_one), which keeps the whole convention one idea.

Origin

Where it came from

i18next 21 shipped the v4 JSON format in 2021, once Intl.PluralRules support was universal enough to lean on. The change retired the numbered v3 suffixes in favor of category names, aligning the largest JavaScript i18n ecosystem with the same CLDR vocabulary Rails subkeys and ICU messages already used.

Trade offs

Strengths and limits

strength

Self describing keys

The suffix is the CLDR name; any human or tool can tell the many form from the few form at a glance.

strength

Flat format friendly

Suffixes work anywhere keys do, properties files included; no tree required.

limit

A convention, not a value

The plural exists only in the naming pattern, so tools that do not know it see unrelated keys.

In locamorph

How locamorph treats i18next v4

The i18next-v4 plural format writes one suffixed key per translated category on export, ready for a v4 era app. Imported suffix keys arrive as the separate keys they literally are; if you want plurals recognized on the way in, carry them as ICU or a category map.

Further reading

Export v4 files ready to ship

Translate with named forms and export one suffixed key per category, exactly what a modern i18next app loads.