Array
The array plural format
The array encoding lists the forms in CLDR order and says nothing else: no category names, no syntax, just position. It is the smallest possible spelling of a plural, and everything it saves in bytes it spends in ambiguity, because only the reader’s knowledge of the language says which entry is which.
This page covers the shape, why it keeps reappearing, its failure mode, and examples in JSON and YAML.
Examples
The same plural, three languages
Two entries for English, four for Polish, six for Arabic; the order is the CLDR canonical one (zero, one, two, few, many, other) filtered to what the language uses.
"items": ["# item", "# items"] "items": [
"# artykuł",
"# artykuły",
"# artykułów",
"# artykułu"
] "items": [
"لا عناصر", "عنصر واحد", "عنصران",
"# عناصر", "# عنصرًا", "# عنصر"
] items:
- "# item"
- "# items" items:
- "# artykuł"
- "# artykuły"
- "# artykułów"
- "# artykułu" How it works
Position is the whole contract
Consumer and producer must agree on the ordering convention, and CLDR canonical order is the sane choice. The trap is partial translation: drop the untranslated second entry of a four form language and every later form silently shifts one place up, with nothing in the file to notice. Labeled encodings fail loudly in the same situation; arrays fail by showing users the wrong string.
Origin
Where it came from
Nowhere in particular, honestly. There is no specification and no founding project; the pattern surfaces independently wherever a developer wants plurals in a format that already has lists and does not want to invent key names: gettext exports flattened to JSON, homegrown pipelines, compact mobile bundles. It persists because it is the encoding you arrive at in five minutes, and it costs its users later for the same reason.
Trade offs
Strengths and limits
Minimal
No syntax, no labels, no escaping concerns; the smallest diff a plural can make.
Ambiguous by design
Nothing in the file says which form is which; correctness rests entirely on order and completeness.
Hostile to partial work
A missing middle form shifts the rest silently; there is no way to mark one form untranslated.
In locamorph
How locamorph treats arrays
Array encoded plurals decompose on import in JSON and YAML, with positions read in CLDR order for the file’s language; reversing an array is inherently approximate, which is one reason the labeled encodings exist. Exports write arrays only when the project explicitly selects the array plural format.
Further reading
- CLDR plural rules, the order the positions follow
Related
Keep going
Arrays in, labeled forms out
Import array encoded files and translators see named forms; export to a labeled encoding and the ambiguity is gone for good.