Skip to content

Optional analytics, session recording and advertising stay off unless you accept. You can reject them and use Transglot. Change your choice anytime in Cookie preferences. Cookie Policy

Back to the blog
Developer platform

Plural Rules in Software: A Complete CLDR Guide (2026)

How CLDR plural categories work: rules for 44 languages computed in Node 22, plural syntax in ten file formats, a checker script and test numbers.

by transglot team
published November 24, 2026
44 min read

Documentation reviewed 23 November 2026.

Quick answer

Plural rules decide which form of a message goes with a number: "1 file" or "5 files" in English, and one of four forms in Russian or six in Arabic. The Unicode CLDR project publishes the rules for each language and names the forms with six categories: zero, one, two, few, many and other. The names are labels, not numbers: in Russian 21 is one, in French 0 is one, and in Latvian 10 is zero. In code, never choose a form with count === 1. Ask a CLDR-backed API such as Intl.PluralRules for the category, store one full sentence per category the language uses, and check every translation for a missing or surplus category.

Who this guide is for

This guide is for developers who write messages with numbers in them, for localization engineers who move plural strings between file formats, and for product leads who need to know why a count on a button is a translation risk. It is also chapter 1 of the short book Notes on Plural Rule Sets.

At the end you will have:

  • The six CLDR categories, the operands a rule is written in, and one rule read line by line.
  • Tables of sample numbers for 44 languages, all computed with Intl.PluralRules.
  • The same plural message written correctly in ten formats, and the traps when converting between them.
  • A script that prints the categories each locale needs and flags ICU messages with a missing or surplus category.
  • A script that generates test numbers per category, and a list of what to tell translators.

Every category in this guide was computed, not recalled. The tables come from Intl.PluralRules in Node.js 22.15.1, which ships ICU 77.1 and CLDR 47. The newest CLDR release is 49, and the three places where it differs for languages named here are marked.


Part 1: why plurals are a software problem

Most code that prints a count starts like this.

The classic failing example: a ternary and string concatenationjs
// Works for English integers and for nothing else.
const label = count + " file" + (count === 1 ? "" : "s");

The line makes four assumptions, and each one is false in some language you may ship in.

  1. There are two forms. Japanese has one, Russian needs four, Arabic needs six.
  2. The singular is for exactly 1. In French 0 also takes the singular category. In Russian 21, 31 and 101 take the same form as 1.
  3. The plural is made by adding a suffix. The noun, the verb and the adjectives around the number can all change.
  4. The number comes first. Word order belongs to the translator, and concatenation takes it away.

Here is what Intl.PluralRules returns for five numbers. A ternary can express the English row and no other.

NumberEnglishFrenchRussianPolishArabicJapanese
0otheronemanymanyzeroother
1oneoneoneoneoneother
2otherotherfewfewtwoother
5otherothermanymanyfewother
21otherotheronemanymanyother

The bug this produces is quiet. Russian does not crash when it gets two forms. It prints "21 файлов" where "21 файл" is correct, on every screen with a count, and nobody on an English-speaking team sees it. That is why plurals belong in the build and the test suite and not in a grammar footnote.

A plural is a function from a number to a category, and the function is different in every language. Code picks the number, CLDR picks the category, the translator writes one sentence per category.
In short

Part 2: the six categories and what they are not

CLDR limits plural categories to six names: zero, one, two, few, many and other. The specification (Unicode Technical Standard 35, Part 3) states that other is mandatory, and every language has it. A language uses between one and six of them.

The names mislead. The CLDR plural rules page says so directly: the categories are "only mnemonics".

CategoryWhat it sounds likeWhat it is in practice
zeroThe number 00 in Arabic and Welsh. In Latvian it is 0, 10 to 20, 30, 40 and so on. In English it does not exist, so 0 is other.
oneThe number 11 in English. 0 and 1 in French. 1, 21, 31, 101 in Russian.
twoThe number 22 in Arabic and Hebrew. 2, 102, 202 in Slovenian.
fewA small amount2 to 4 in Czech. Exactly 3 in Welsh. 0 and 2 to 19 in Romanian.
manyA large amount5 to 20 in Russian. Exactly 6 in Welsh. Only decimals in Czech. Whole millions in French.
otherEverything elseThe general form, and the only form in Japanese. In Russian and Polish it is used for decimals only.

Three consequences follow.

  • A category is not a test for a value. one does not mean "the count is 1", so a one message that says "One file" without the number is wrong for 21 in Russian. Android's documentation gives the same warning: always include the number in one, because translators need it in languages where one does not mean 1.
  • zero is not "the empty state". English has no zero category. To say "No files" for 0 in English you need an exact match (=0 in ICU), which is a different mechanism from a category. Part 7 covers it.
  • The source language's categories say nothing about the target's. An English message has one and other. Its Arabic translation needs six.
Never read a category name as a number. one, two and zero are labels for "the form this language uses for numbers that behave like 1, 2 or 0".
Rule
Six cream paper tiles on a stone plinth, each embossed with a category name, with numbered tokens sorted beneath them
Six category names, and different numbers under each in every language

Part 3: how a rule is written in CLDR

Each language's rules live in one CLDR file, plurals.xml. A rule is a condition on a number. Conditions are checked in the order zero, one, two, few, many, the first true one gives the category, and if none is true the category is other.

The operands

A rule cannot just test the number, because "1" and "1.0" can take different forms. So the specification defines operands that describe the number as it is displayed.

OperandMeaning (from UTS 35)11.01.301.2c6
nThe absolute value of the number111.31200000
iThe integer digits1111200000
vThe number of visible fraction digits, with trailing zeros0120
wThe number of visible fraction digits, without trailing zeros0010
fThe visible fraction digits, with trailing zeros, as an integer00300
tThe visible fraction digits, without trailing zeros, as an integer0030
cThe compact decimal exponent: the power of 10 used in compact formatting0006
eA deprecated synonym for c0006

1.2c6 is the notation for a number shown in compact form, such as "1.2M". The published rules still use e.

The syntax

  • = and != compare an operand, or an operand modulo a number, with a value. i % 10 = 1 is true when the integer part ends in 1.
  • a..b is every integer from a to b. A comma separates alternatives: n = 3, 5, 7..15.
  • and binds more tightly than or.
  • After the condition, the file lists samples: @integer 1, 21, 31, … and @decimal 1.0, 21.0, …. A range of samples is written 2~4.

One rule set, line by line

This is Polish in CLDR 47, the data Node 22 ships. CLDR 49 has the same text.

The Polish cardinal rule set from CLDR plurals.xmltext
one = i = 1 and v = 0
few = v = 0 and i % 10 = 2..4 and i % 100 != 12..14
many = v = 0 and i != 1 and i % 10 = 0..1
or v = 0 and i % 10 = 5..9
or v = 0 and i % 100 = 12..14
other = (no condition)
  • one: the integer part is 1 and there are no visible fraction digits. Only the number 1. Not 1.0, not 21.
  • few: no fraction digits, the last digit is 2, 3 or 4, and the last two digits are not 12, 13 or 14. So 2, 3, 4, 22, 23, 24, 102, but not 12.
  • many: no fraction digits and one of three cases. The number ends in 0 or 1 and is not 1 itself (0, 10, 11, 20, 21, 101). Or it ends in 5 to 9. Or its last two digits are 12 to 14.
  • other: whatever is left. Every integer is already covered, so other is used only when v is not 0: 1.5, 2.0, 0.5.

The Russian one rule is v = 0 and i % 10 = 1 and i % 100 != 11. It tests the last digit, where Polish tests the whole number. That one difference is why 21 is one in Russian and many in Polish.


Part 4: cardinals, ordinals and ranges

Everything so far is about cardinal numbers: how many. CLDR has two more kinds of plural data.

Ordinals

Ordinal rules pick the form for a position: 1st, 2nd, 3rd. They live in a separate file, ordinals.xml, and they are a separate rule set per language. English has two cardinal categories and four ordinal ones.

Ordinal category (English)RuleNumbersSuffix
onen % 10 = 1 and n % 100 != 111, 21, 101st
twon % 10 = 2 and n % 100 != 122, 22nd
fewn % 10 = 3 and n % 100 != 133, 23rd
othereverything else4, 11, 12, 13, 111th

The same names mean different things in the two rule sets. English cardinal one is 1. English ordinal one is 1, 21, 31 and 101. Other languages differ again: computed in Node 22, French ordinals have one for 1 only (the "1er" case), Swedish one covers 1, 2, 21 and 22, Welsh uses all six categories, and Russian, German and Japanese have only other.

Ranges

"1 to 5 files" has two numbers and one noun. CLDR's pluralRanges data maps the categories of the start and the end of a range to the category of the whole range. If a language has no entry for a pair, the specification says the result is the category of the end.

Computed with selectRange in Node 22: English 1 to 2 is other, French 0 to 1 is one, Russian 1 to 5 is many, Russian 1 to 21 is one, Polish 1 to 2 is few.


Part 5: a tour by language family

Each table below was produced by new Intl.PluralRules(locale).select(n) in Node 22.15.1 (CLDR 47). The rule in words is read from the CLDR 47 plurals.xml.

No plural distinction: Japanese, Chinese, Korean, Thai, Vietnamese

The rule set has one category, other. Every number takes it.

Locale012211.5
ja, zh, ko, th, viotherotherotherotherother

The mistake: writing a one branch that carries meaning, such as "a file" against "5 files", or using a plural to switch between "Inbox" and "Inbox (12)". Android's documentation uses that exact example: in a language with no plural distinction you always get the other string, so the one text never shows.

Version note: in CLDR 49 plurals.xml, Vietnamese moved to the rule set one: i = 0 or n = 1. A runtime on CLDR 47 or 48 reports only other for vi, and one on CLDR 49 reports one and other. Check what your own runtime returns.

Two forms: where does 0 go?

English and German use one for the integer 1 (i = 1 and v = 0). French uses one for 0 and 1 and for anything whose integer part is 0 or 1 (i = 0,1). Hindi uses one for 0 and 1 (i = 0 or n = 1).

Numberendefrpt-BRpt-PThi
0otherotheroneoneotherone
1oneoneoneoneoneone
2otherotherotherotherotherother
1.5otherotheroneoneotherother

CLDR does show a difference inside Portuguese. pt (which pt-BR uses) has one: i = 0..1, like French. pt_PT has its own entry, one: i = 1 and v = 0, like Italian. So 0 is one in Brazilian Portuguese and other in European Portuguese.

The mistake: n === 1 ? singular : plural. It prints the plural for 0 in French and Brazilian Portuguese, and for 1.5 in French. The second mistake is treating pt as one locale for plurals.

Three forms: Latvian and Romanian

Latvian uses zero, one and other. zero is for numbers ending in 0 and for 11 to 19. one is for numbers ending in 1, except 11. Romanian uses one, few and other. few is for 0, for 2 to 19, and for numbers ending in 01 to 19 after a hundred. Every decimal in Romanian is few as well.

Number012101119202122101111
lvzerooneotherzerozerozerozerooneotheronezero
rofewonefewfewfewfewotherotherotherfewfew

The mistake: reading Latvian zero as "nothing" and writing "No files" in it. That message would then show for 10, 20 and 30 files. In Romanian, the mistake is assuming few stops at a small number: 119 is few and 20 is other.

The East Slavic pattern, and Polish

Russian, Ukrainian and Belarusian share one rule set with four categories. one: ends in 1, not 11. few: ends in 2 to 4, not 12 to 14. many: ends in 0 or 5 to 9, or in 11 to 14. other: decimals. Polish has the same four names and a different one.

Number012511122122251011111.5
ru, ukmanyonefewmanymanymanyonefewmanyonemanyother
plmanyonefewmanymanymanymanyfewmanymanymanyother

In Russian: 1 файл, 2 файла, 5 файлов, 21 файл, 1,5 файла. In Polish: 1 plik, 2 pliki, 5 plików, 21 plików, 1,5 pliku.

The mistake: copying a Russian setup to Polish, or the reverse. The category names match, so nothing fails, and 21, 31 and 101 come out wrong. The second mistake is leaving other out because "it is never used". It is used for every decimal, and the ICU parser used in Part 10 rejects a plural without it.

Czech and Slovak

one is 1. few is 2, 3 and 4 and nothing else. many is any number with visible fraction digits. other is the rest, which means 0 and every integer from 5.

Number0124521221001.5
cs, skotheronefewfewotherotherotherothermany

The mistake: assuming a Slavic language follows the Russian modulo pattern. In Czech 22 is other, not few, and many has nothing to do with large numbers.

Lithuanian

one: ends in 1, not 11. few: ends in 2 to 9, not 12 to 19. many: has a fraction. other: ends in 0, or is 11 to 19.

Number012910112021221011.5
ltotheronefewfewotherotherotheronefewonemany

Android's documentation uses Lithuanian to show why the number must be in the sentence: the singular form is used for 1 and for 101, so "1 knyga" and "101 knyga" share one string.

Slovenian and the dual

Slovenian has a grammatical dual, so it uses two. The rule looks at the last two digits: one for 01, two for 02, few for 03 and 04 and for every decimal, other for the rest.

Number0123451011021031051.5
slotheronetwofewfewotheronetwofewotherfew

The ICU documentation gives the four forms for "dog": pes, psa, psi, psov.

The mistake: treating two as the value 2. In Slovenian 102 and 202 are two.

Celtic languages: Welsh and Irish

Welsh uses all six categories and each of the first five is a single number: 0, 1, 2, 3 and 6. Irish uses five: one for 1, two for 2, few for 3 to 6, many for 7 to 10, other for 0 and from 11.

Number012345671011100
cyzeroonetwofewotherothermanyotherotherotherother
gaotheronetwofewfewfewfewmanymanyotherother

The mistake: reading few and many as sizes. In Welsh few is exactly 3 and many is exactly 6, so 4, 5 and 7 are other.

Semitic languages: Arabic and Hebrew

Arabic uses all six, and two of the rules are modulo 100.

The Arabic cardinal rule set from CLDR plurals.xmltext
zero = n = 0
one = n = 1
two = n = 2
few = n % 100 = 3..10
many = n % 100 = 11..99
other = (no condition)
Number01231011991001011021031111000
arzeroonetwofewfewmanymanyotherotherotherfewmanyother
heotheronetwootherotherotherotherotherotherotherotherotherother

Because of the modulo, the pattern repeats in every hundred: 103 is few again and 111 is many. The numbers 100, 101 and 102 match nothing and fall to other. Hebrew in CLDR 47 has three categories: one, two and other.

The mistake: assuming other is the form for large numbers and many for the largest. In Arabic 11 is many and 1000 is other. The second mistake is giving Arabic fewer than six forms because the source had two.

Maltese

Maltese resembles Arabic with two differences: there is no zero, and 0 is few. few is 0 and numbers ending in 03 to 10, many is numbers ending in 11 to 19.

Number012310111920100101103111
mtfewonetwofewfewmanymanyotherotherotherfewmany

The `many` for millions in French, Spanish and Italian

French, Spanish, Italian, Portuguese and Catalan list three categories, not two. The third is many, with this rule.

The many rule shared by French, Spanish, Italian, Portuguese and Catalantext
many = e = 0 and i != 0 and i % 1000000 = 0 and v = 0
or e != 0..5

The first line: the number is not in compact form, it is not zero, it has no fraction digits, and it is an exact multiple of one million. The second line: the number is in compact form with an exponent of 6 or more. It exists for phrases such as the French "1 million de fichiers", where a word is added after "million".

Number100099999910000001000001150000020000001000000000
fr, es, it, pt, caotherothermanyotherothermanymany

The surprise: a checker that asks these locales for their categories gets one, many, other, and a French message with only one and other is reported as incomplete. The report is correct. Give many a string, even if it repeats other.

Node 22.15.1 does not apply the notation: "compact" option in Intl.PluralRules (it is absent from resolvedOptions()), so the compact half of the rule was not computed for this guide. MDN documents the option and shows it with French.

A cream paper abacus on a stone plinth with rows of beads grouped differently for each language, one teal glass bead on the 21st position
The same numbers land in different categories in each language family

Part 6: decimals, and why 1.0 is not 1

In English you write "1 star" and "1.0 stars". The value is the same and the form is not, which is what operand v is for. The English rule is i = 1 and v = 0, so the moment a fraction digit is visible the category is other.

A JavaScript number does not remember its trailing zeros, so pass the same digit options to Intl.PluralRules that you pass to Intl.NumberFormat. In this table the columns after the first were computed with minimumFractionDigits: 1.

Locale11.01.50.52.05.0
en, de, itoneotherotherotherotherother
esoneoneotherotherotherother
froneoneoneoneotherother
ru, ploneotherotherotherotherother
cs, skonemanymanymanymanymany
ltoneonemanymanyfewfew
lvoneoneotherotherotherother
ro, slonefewfewfewfewfew
daoneoneoneoneotherother
aroneoneotherothertwofew
heoneotherotheroneotherother

Spanish keeps one for 1.0 because its rule is n = 1, which ignores v. French keeps one for 1.5 because its rule looks only at the integer part.

If a count can be shown with decimals (ratings, hours, kilometres, gigabytes), the plural category must be computed with the same fraction digits the user sees. A selector that receives 1 while the screen shows "1.0" picks the wrong form in English.
Watch out

In Node 22.15.1, new Intl.PluralRules("en").select("1.0") returned one: the string was converted to a number first. Use the digit options, not a string.


Part 7: how each format encodes plurals

The same message, "N files" in Russian, in each format. The Russian forms are файл (one), файла (few), файлов (many) and файла (other, for decimals).

ICU MessageFormat

ICU MessageFormat: categories, one exact match and the # placeholdertext
{count, plural,
=0 {Нет файлов}
one {# файл}
few {# файла}
many {# файлов}
other {# файла}
}
  • plural selects by the cardinal rules. selectordinal has the same grammar and selects by the ordinal rules.
  • =0 is an explicit value. ICU matches the number against explicit values first, then against category keywords. UTS 35 states that the explicit 0 and 1 cases apply to the exact values 0 and 1 and take precedence over zero and one.
  • # is replaced by the number, formatted for the locale. With an offset it is the number minus the offset.
  • other is required.
  • offset:1 subtracts 1 before the category is chosen and before # is printed. It exists for "Ana and 2 others".
offset: with guests = 3 this prints "Ana and 2 other people are coming"text
{guests, plural, offset:1
=0 {Nobody is coming}
=1 {{host} is coming alone}
one {{host} and one other person are coming}
other {{host} and # other people are coming}
}
selectordinal in English: 1st, 2nd, 3rd, 4th, 11th, 21sttext
You finished {place, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}

All three messages were parsed with @formatjs/icu-messageformat-parser 3.5 and evaluated for this guide. The Russian message gave "Нет файлов", "1 файл", "2 файла", "5 файлов", "21 файл", "11 файлов" and "1,5 файла".

=1 and one are different selectors. {count, plural, =1 {# файл} other {# файлов}} in Russian printed "21 файлов" in the test, because 21 is not the value 1. Use one for the category, and =0 or =1 only for wording that belongs to that exact number.
Watch out

gettext PO

gettext PO: the header declares the forms, the entry fills them by indexpo
msgid ""
msgstr ""
"Language: ru\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
msgid "%d file"
msgid_plural "%d files"
msgstr[0] "%d файл"
msgstr[1] "%d файла"
msgstr[2] "%d файлов"

The header belongs to the file, not to gettext. nplurals is the number of forms and plural is a C expression over n that returns an index from 0. The expression above is the one the gettext manual lists for Russian.

The indexes are not CLDR categories.

  • An index means what the header's expression makes it mean. Running the manual's expressions against Intl.PluralRules for 0 to 1000: msgstr[2] is CLDR many in a Russian file and CLDR other in a Czech or Lithuanian file.
  • The manual's expressions do not always split numbers the way CLDR does. Its Latvian expression puts only 0 in the third form, where CLDR zero also covers 10 to 20. Its Irish expression has three forms, where CLDR has five categories.
  • n is an integer. A three-form Russian PO file has no slot for the decimal form that CLDR calls other.

Android `<plurals>`

xmlxml
<!-- res/values-ru/strings.xml -->
<plurals name="file_count">
<item quantity="one">%d файл</item>
<item quantity="few">%d файла</item>
<item quantity="many">%d файлов</item>
<item quantity="other">%d файла</item>
</plurals>
Android: the count is passed twice, once to select and once to fill %dkotlin
val text = resources.getQuantityString(R.plurals.file_count, count, count)

The quantity values are the six CLDR names. The Android documentation states that selection is by grammatical necessity: an English zero item is ignored even when the quantity is 0. In Compose the call is pluralStringResource. From API 24 the ICU MessageFormat class is available as an alternative.

Apple `.stringsdict` and String Catalogs

Apple .stringsdict: one variable dictionary with a string per categoryxml
<key>%d file(s)</key>
<dict>
<key>NSStringLocalizedFormatKey</key>
<string>%#@files@</string>
<key>files</key>
<dict>
<key>NSStringFormatSpecTypeKey</key>
<string>NSStringPluralRuleType</string>
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
<string>%d файл</string>
<key>few</key>
<string>%d файла</string>
<key>many</key>
<string>%d файлов</string>
<key>other</key>
<string>%d файла</string>
</dict>
</dict>

Apple's documentation says that from Xcode 15 String Catalogs are the recommended way to localize plurals, and that .stringsdict is for earlier versions. In a catalog you Control-click the key, choose Vary by Plural, and Xcode adds the plural forms for each language. A message with two numbers gets one variable dictionary per number. Apple's page also notes that English requires only one and other and that zero is optional there, which differs from Android.

Flutter ARB

jsonjson
{
"fileCount": "{count, plural, =0{No files} =1{1 file} other{{count} files}}",
"@fileCount": {
"description": "Number of files in a folder",
"placeholders": { "count": { "type": "num" } }
}
}

ARB values hold ICU-style plural messages. Flutter's guide writes the options as =0, =1, =2, few, many and other, and says only other is required. The Dart intl package's Intl.plural takes zero, one, two, few, many and a mandatory other, plus a precision argument for the visible fraction digits.

i18next suffixes

jsonjson
{
"file_one": "{{count}} файл",
"file_few": "{{count}} файла",
"file_many": "{{count}} файлов",
"file_other": "{{count}} файла"
}

One key per category, with the category as a suffix, and the number passed as count: t("file", { count: 5 }). The i18next documentation says the form is chosen with Intl.PluralRules, that a _zero key wins for a count of 0 where it exists, and that ordinals use keys such as _ordinal_one with ordinal: true. More in the i18next best practices guide.

Vue I18n pipes

Vue I18n: positional choices, which need a custom rule for Russianjs
const messages = {
ru: { file: "{n} файлов | {n} файл | {n} файла | {n} файлов" },
};

Choices are separated by | and selected by position with $t("file", 5). The Vue I18n guide says the default selection does not apply to all languages, names Slavic languages, and shows a custom function passed as pluralRules (Composition API) or pluralizationRules (Options API). The order above matches the Russian example in that guide: zero, one, few, many.

Rails and Laravel

yamlyaml
ru:
files:
one: "%{count} файл"
few: "%{count} файла"
many: "%{count} файлов"
other: "%{count} файла"
Rails uses category keys under the message key, Laravel uses pipes with optional rangesphp
// lang/en/messages.php
'files' => '{0} No files|{1} :count file|[2,*] :count files',
echo trans_choice('messages.files', 5);

Rails looks up a sub-key by category with I18n.t("files", count: 5). The Rails guide shows that the default algorithm knows only one and other (plus an optional zero for a count of 0), and that locale-specific rules come from the I18n Pluralization backend or the rails-i18n gem. Laravel separates forms with |, allows exact values and ranges such as {0} and [2,*], and fills :count.

Fluent

ftlftl
files =
{ $count ->
[one] { $count } файл
[few] { $count } файла
[many] { $count } файлов
*[other] { $count } файла
}

Fluent selectors match a number against CLDR plural categories. The variant marked * is the default and is required. A literal number is an exact match, and NUMBER($pos, type: "ordinal") selects by ordinal rules.

What each format can express

FormatForms identified byExact-value matchOrdinalsDecimal form
ICU MessageFormatCLDR categoryYes, =NselectordinalYes
FluentCLDR categoryYes, [1]NUMBER(type: "ordinal")Yes
Flutter ARBICU plural messageYes, =0, =1, =2Not covered hereprecision in Intl.plural
i18next JSONCLDR category suffix_zero for 0_ordinal_ suffixesNot checked
Android XMLCLDR categoryNoNoNot checked
Apple stringsdict, String CatalogCLDR categoryNoNoNot checked
Rails YAMLCategory keyzero for 0 in the default ruleNoNot checked
gettext POIndex from the header expressionNoNoNo, n is an integer
Vue I18n, LaravelPosition in a pipe listLaravel: {0}, rangesNoNot checked

Conversion pitfalls

  • PO to anything with categories. Map each index through the file's own Plural-Forms expression, per language. Do not assume index 2 is many.
  • Categories to PO. The decimal category has nowhere to go, and the number of forms must match nplurals.
  • ICU to Android or Apple. =0 and =1 have no counterpart, and offset has none anywhere else. Move that logic into code or split the message into two keys.
  • Exact zero. ICU =0, i18next _zero, Rails zero and Laravel {0} all mean "the number 0". CLDR zero means a category, which in Latvian includes 10 and 20. Converting one into the other changes behaviour.
  • Pipes. Vue and Laravel forms are positional. A translator who adds or reorders a segment changes which numbers it applies to.
  • Two-form sources. Any converter that copies the source's shape gives Russian two forms. The target's category list must come from CLDR, not from the source file.

Part 8: design decisions that follow

Never concatenate. Store the whole sentence in each form. The translator needs to move the number, change the verb and change the adjective.

Keep the number inside the sentence. A one form without the number breaks for 21 in Russian and 101 in Lithuanian. If the design calls for "One file", use =1 for that wording and keep one {# file} for the category.

Use an exact match for zero. "No files" is a different sentence, not a plural form. Write =0 {No files} in formats that support it, and an if in code where they do not.

Avoid two numbers in one message, or nest correctly. "5 photos in 2 albums" needs a form for every pair of categories. Nest the second plural inside each branch of the first and write full sentences at the leaves. Inside the inner plural # means the inner number, so print the outer one by name.

Two numbers: four leaves in English, sixteen in Russian, thirty-six in Arabictext
{photos, plural,
one {{albums, plural,
one {{photos, number} photo in # album}
other {{photos, number} photo in # albums}}}
other {{albums, plural,
one {{photos, number} photos in # album}
other {{photos, number} photos in # albums}}}
}

That count is the argument for splitting such a message into two sentences, or for a neutral layout such as "Photos: 5. Albums: 2". Android's documentation recommends the same kind of quantity-neutral wording where the style allows.

Gender plus plural: select outside, plural inside. The ICU guide advises putting complex arguments at the outermost level, writing full sentences in the sub-messages, and placing select outside plural.

Gender and plural: every leaf is a complete sentencetext
{gender, select,
female {{count, plural, one {She shared # file} other {She shared # files}}}
male {{count, plural, one {He shared # file} other {He shared # files}}}
other {{count, plural, one {They shared # file} other {They shared # files}}}
}

Lists and units are not plural messages. Do not build "5 kilometers" from a plural key. Intl.NumberFormat with style: "unit" and unitDisplay: "long" returned "5 kilometers", "5 километров" and "3 километра" in Node 22. For "Ana, Ben, and Chen" use Intl.ListFormat.

Give the UI room for the longest form. A language with four forms has four lengths. Size the control for the longest form of the longest language, with a large number in it, not for the English one.

One message, one number, one full sentence per category. Every departure from that multiplies the number of strings a translator must get right.
Rule

Part 9: runtime APIs

JavaScript: Intl.PluralRules

Intl.PluralRules: select, selectRange and pluralCategories, run on Node 22.15.1js
const ORDER = ["zero", "one", "two", "few", "many", "other"];
const ru = new Intl.PluralRules("ru");
console.log(ru.select(1), ru.select(3), ru.select(5), ru.select(21));
// one few many one
// Decimals: visible fraction digits change the category.
console.log(new Intl.PluralRules("en").select(1)); // one
console.log(new Intl.PluralRules("en", { minimumFractionDigits: 1 }).select(1)); // other
// Ordinals are a different rule set.
const enOrdinal = new Intl.PluralRules("en", { type: "ordinal" });
console.log([1, 2, 3, 4, 11, 21].map((n) => enOrdinal.select(n)).join(" "));
// one two few other other one
// Ranges.
console.log(new Intl.PluralRules("fr").selectRange(0, 1)); // one
console.log(new Intl.PluralRules("ru").selectRange(1, 5)); // many
// The categories a locale uses. Sort them yourself.
const used = new Intl.PluralRules("ar").resolvedOptions().pluralCategories;
console.log(ORDER.filter((c) => used.includes(c)).join(", "));
// zero, one, two, few, many, other

MDN lists Intl.PluralRules as widely available since September 2019 and selectRange since August 2023. In Node 22.15.1 pluralCategories for Arabic came back as few, many, one, two, zero, other, so do not rely on its order.

ICU4J and ICU4C

ICU is the reference implementation of CLDR. In ICU4J, PluralRules.forLocale(locale) returns the cardinal rules and an overload takes a PluralType for ordinals. select(double) returns the keyword, select(FormattedNumber) takes a formatted number so that visible digits count, and getKeywords() lists the categories. ICU4C mirrors this with PluralRules::forLocale(locale, type, status) and a UPluralType, and its select also accepts a FormattedNumberRange for ranges. MessageFormat in both wraps these for plural and selectordinal arguments.

Platform equivalents

PlatformAPI named in its documentation
AndroidgetQuantityString(), pluralStringResource() in Compose, android.icu.text.MessageFormat from API 24
AppleString Catalog plural variations, or .stringsdict with NSStringPluralRuleType
Flutter and DartGenerated methods from ARB, Intl.plural() in the intl package
i18nextt(key, { count }), with ordinal: true for ordinals
RailsI18n.t(key, count: n)
Laraveltrans_choice(key, n)
FluentSelector expressions, NUMBER() for ordinals

Part 10: a checker for ICU messages

This script takes a folder of <locale>.json files whose values are ICU messages. It prints the categories each locale needs, then reports every plural that lacks a required category or uses one the language does not have. Exact selectors such as =0 are ignored, because they are not categories.

plural-check.mjs: required and surplus plural categories per localejs
// plural-check.mjs
// Usage: node plural-check.mjs <folder of <locale>.json files>
import { readFileSync, readdirSync } from "node:fs";
import { join, basename } from "node:path";
import { parse, TYPE } from "@formatjs/icu-messageformat-parser";
const ORDER = ["zero", "one", "two", "few", "many", "other"];
// The categories a locale needs, in CLDR order. The runtime does not sort them.
function needed(locale, type = "cardinal") {
const have = new Intl.PluralRules(locale, { type }).resolvedOptions().pluralCategories;
return ORDER.filter((c) => have.includes(c));
}
// Collect every plural and selectordinal argument, at any nesting depth.
function plurals(ast, out = []) {
for (const el of ast) {
if (el.type === TYPE.plural) {
out.push({ arg: el.value, type: el.pluralType, keys: Object.keys(el.options) });
}
if (el.type === TYPE.plural || el.type === TYPE.select) {
for (const option of Object.values(el.options)) plurals(option.value, out);
}
if (el.type === TYPE.tag) plurals(el.children, out);
}
return out;
}
const dir = process.argv[2];
const files = readdirSync(dir).filter((f) => f.endsWith(".json")).sort();
let problems = 0;
console.log("Categories each locale needs (cardinal | ordinal)");
for (const file of files) {
const locale = basename(file, ".json");
console.log(` ${locale.padEnd(6)} ${needed(locale).join(", ")} | ${needed(locale, "ordinal").join(", ")}`);
}
console.log("\nProblems");
for (const file of files) {
const locale = basename(file, ".json");
const messages = JSON.parse(readFileSync(join(dir, file), "utf8"));
for (const [key, text] of Object.entries(messages)) {
let found;
try {
found = plurals(parse(text));
} catch (error) {
console.log(` ${locale}\t${key}\tinvalid ICU: ${error.message}`);
problems++;
continue;
}
for (const p of found) {
const want = needed(locale, p.type);
const keywords = p.keys.filter((k) => !k.startsWith("="));
const missing = want.filter((c) => !keywords.includes(c));
const extra = keywords.filter((k) => !want.includes(k));
if (missing.length) {
console.log(` ${locale}\t${key}\t{${p.arg}} ${p.type} lacks: ${missing.join(", ")}`);
problems++;
}
if (extra.length) {
console.log(` ${locale}\t${key}\t{${p.arg}} ${p.type} has unused: ${extra.join(", ")}`);
problems++;
}
}
}
}
console.log(problems ? `\n${problems} problem(s)` : " none");
process.exit(problems ? 1 : 0);

It was run on six sample files, each with a files and a place message. Five of them carried a planted defect: Russian and French copied the English shape, Japanese kept a one branch, Polish left out other, and Arabic had an unclosed brace.

Output on the sample files, Node 22.15.1, exit code 1text
Categories each locale needs (cardinal | ordinal)
ar zero, one, two, few, many, other | other
en one, other | one, two, few, other
fr one, many, other | one, other
ja other | other
pl one, few, many, other | other
ru one, few, many, other | other
Problems
ar place invalid ICU: EXPECT_ARGUMENT_CLOSING_BRACE
fr files {count} cardinal lacks: many
ja files {count} cardinal has unused: one
pl files invalid ICU: MISSING_OTHER_CLAUSE
ru files {count} cardinal lacks: few, many
5 problem(s)

The script answers for the CLDR version in your runtime. Run it on the Node version that CI uses, and expect the list for a language to change when the runtime moves to a newer CLDR. For the other static checks that belong next to this one, see React localization CI checks.


Part 11: testing plurals

A test that renders a message with 1 and 2 proves the English rule. Each language needs at least one number per category, plus the numbers where the rule changes.

LanguageBoundary numbers to test
English0, 1, 2, and 1.0 if decimals can appear
French0, 1, 1.5, 2, 1000000
Russian, Ukrainian0, 1, 2, 4, 5, 11, 12, 14, 21, 22, 25, 101, 111, 1.5
Polish0, 1, 2, 5, 12, 21, 22, 101, 112, 1.5
Czech, Slovak0, 1, 2, 4, 5, 1.5
Lithuanian0, 1, 2, 9, 10, 11, 21, 1.5
Latvian0, 1, 2, 10, 11, 21
Romanian0, 1, 2, 19, 20, 101, 120
Slovenian1, 2, 3, 4, 5, 101, 102, 103
Arabic0, 1, 2, 3, 10, 11, 99, 100, 102, 103
Welsh0, 1, 2, 3, 4, 6, 7
Japanese, Chinese, Korean1 and 2, to confirm the same string appears

Do not maintain such a table by hand. Generate it from the runtime.

plural-samples.mjs: test numbers for every category of every localejs
// plural-samples.mjs
// Usage: node plural-samples.mjs en fr ru pl ar
const ORDER = ["zero", "one", "two", "few", "many", "other"];
const CANDIDATES = [
...Array.from({ length: 131 }, (_, i) => i), // 0 to 130 covers every modulo-100 rule
200, 201, 202, 203, 211, 1000, 1001, 1002, 1011, 1000000, 2000000,
];
for (const locale of process.argv.slice(2)) {
const integers = new Intl.PluralRules(locale);
const oneDecimal = new Intl.PluralRules(locale, { minimumFractionDigits: 1 });
const byCategory = Object.fromEntries(ORDER.map((c) => [c, { int: [], dec: [] }]));
for (const n of CANDIDATES) byCategory[integers.select(n)].int.push(n);
for (const n of [0, 1, 1.5, 2, 5]) byCategory[oneDecimal.select(n)].dec.push(n.toFixed(1));
console.log(locale);
for (const category of ORDER) {
const { int, dec } = byCategory[category];
if (!int.length && !dec.length) continue;
// The first four, then the first value past 100 and past 1000.
const pick = [...new Set([...int.slice(0, 4), int.find((n) => n > 100), int.find((n) => n > 1000)])]
.filter((n) => n !== undefined);
console.log(` ${category.padEnd(5)} integers: ${pick.join(", ") || "none"} decimals: ${dec.join(", ") || "none"}`);
}
}
Output for ru and ar on Node 22.15.1text
ru
one integers: 1, 21, 31, 41, 101, 1001 decimals: none
few integers: 2, 3, 4, 22, 102, 1002 decimals: none
many integers: 0, 5, 6, 7, 105, 1011 decimals: none
other integers: none decimals: 0.0, 1.0, 1.5, 2.0, 5.0
ar
zero integers: 0 decimals: 0.0
one integers: 1 decimals: 1.0
two integers: 2 decimals: 2.0
few integers: 3, 4, 5, 6, 103 decimals: 5.0
many integers: 11, 12, 13, 14, 111, 1011 decimals: none
other integers: 100, 101, 102, 200, 1001 decimals: 1.5

Feed those numbers into a unit test that formats each plural message and asserts that the output contains the number and is not empty. For screenshots, render each plural message once per category with the largest sample, so the longest form is the one that gets measured. The wider test plan is in automated localization QA.


Part 12: what translators need to be told

A translator sees a string, not your code. Put the following in the key's description or the translation brief.

  • What the number counts. "Number of files in the folder", not "count".
  • The range and type of the number. Can it be 0? Can it be a decimal? Can it reach millions? This decides which forms will ever show.
  • That the forms are CLDR categories. Say that one is the form for numbers that behave like 1 in their language, and give the sample numbers from the script above.
  • That the number must stay in every form. #, %d or {count} appears in one too.
  • That keywords are not text. one, few, plural, =0 and the argument name stay in English.
  • Which forms are exact. If =0 is present, it is for the number 0 only, and the category forms still have to be complete.
  • The room available. The pixel or character limit applies to the longest form.
  • What agrees with the number. If the sentence has a gender or a second number, say so, and show the nesting.

Part 13: what AI translation gets wrong with plurals

Machine translation of a plural message is translation of a small program. The failure modes below are structural, so a script can catch them. They were not measured as rates for this guide.

FailureExampleHow to catch it
The source's shape is copiedA Russian message with only one and otherCompare the keywords with the target's categories (Part 10)
A category the language lacks is addedone in Japanese, zero in EnglishThe same comparison, for surplus keywords
A keyword or argument name is translatedotro {...}, {cantidad, plural, ...}Parse the message, compare argument names with the source
The number is replaced by a digit or a wordone {1 файл}, which is wrong for 21Check that each category form contains # or the placeholder
=1 is used in place of oneCorrect for 1, wrong for 21 and 101Flag =1 where the locale's one covers more than the value 1
Braces or apostrophes breakAn unclosed {, or an apostrophe that starts ICU quotingParse every output before it is written
All forms are identicalThe few and many text is the same as oneWarn when all forms of a multi-form language match
The grammar of a form is wrongThe right number of forms with the wrong noun endingNo script. A native speaker reads the forms next to the sample numbers

The first seven are mechanical. Run the parser and the category comparison on every machine-translated string, and reject or retry before the string reaches a file. The last one is linguistic, and it is the reason a review pass with real numbers is still worth doing for the languages with four or more forms.


Part 14: quick reference for 44 languages

Computed in Node 22.15.1 (CLDR 47). The middle column is the cardinal category for 0, 1, 2, 5 and 21.

LanguageCodeCardinal categories0 / 1 / 2 / 5 / 21Ordinal categories
Englishenone, otherother / one / other / other / otherone, two, few, other
Chinesezhotherother / other / other / other / otherother
Hindihione, otherone / one / other / other / otherone, two, few, many, other
Spanishesone, many, otherother / one / other / other / otherother
Frenchfrone, many, otherone / one / other / other / otherone, other
Arabicarzero, one, two, few, many, otherzero / one / two / few / manyother
Bengalibnone, otherone / one / other / other / otherone, two, few, many, other
Portuguese (Brazil)pt-BRone, many, otherone / one / other / other / otherother
Portuguese (Portugal)pt-PTone, many, otherother / one / other / other / otherother
Russianruone, few, many, othermany / one / few / many / oneother
Urduurone, otherother / one / other / other / otherother
Indonesianidotherother / other / other / other / otherother
Germandeone, otherother / one / other / other / otherother
Japanesejaotherother / other / other / other / otherother
Turkishtrone, otherother / one / other / other / otherother
Koreankootherother / other / other / other / otherother
Vietnameseviotherother / other / other / other / otherone, other
Italianitone, many, otherother / one / other / other / othermany, other
Thaithotherother / other / other / other / otherother
Polishplone, few, many, othermany / one / few / many / manyother
Ukrainianukone, few, many, othermany / one / few / many / onefew, other
Dutchnlone, otherother / one / other / other / otherother
Romanianroone, few, otherfew / one / few / few / otherone, other
Greekelone, otherother / one / other / other / otherother
Czechcsone, few, many, otherother / one / few / other / otherother
Slovakskone, few, many, otherother / one / few / other / otherother
Swedishsvone, otherother / one / other / other / otherone, other
Hungarianhuone, otherother / one / other / other / otherone, other
Hebrewheone, two, otherother / one / two / other / otherother
Danishdaone, otherother / one / other / other / otherother
Finnishfione, otherother / one / other / other / otherother
Norwegian Bokmålnbone, otherother / one / other / other / otherother
Bulgarianbgone, otherother / one / other / other / otherother
Croatianhrone, few, otherother / one / few / other / oneother
Serbiansrone, few, otherother / one / few / other / oneother
Lithuanianltone, few, many, otherother / one / few / few / oneother
Latvianlvzero, one, otherzero / one / other / other / oneother
Slovenianslone, two, few, otherother / one / two / other / otherother
Persianfaone, otherone / one / other / other / otherother
Filipinofilone, otherone / one / one / one / oneone, other
Welshcyzero, one, two, few, many, otherzero / one / two / other / otherzero, one, two, few, many, other
Irishgaone, two, few, many, otherother / one / two / few / otherone, other
Maltesemtone, two, few, many, otherfew / one / two / few / otherother
Catalancaone, many, otherother / one / other / other / otherone, two, few, other

Changes in CLDR 49, read from its data files: Vietnamese cardinals gain one, and the ordinal rules for Spanish and Bulgarian gain categories. A runtime on CLDR 49 will print different rows for those three.

A cream paper card catalogue drawer on a stone plinth, pulled open to show index cards with language codes and one teal glass divider
One row per language: the categories it needs

Doing this with Transglot

Transglot stores a plural string as one form per CLDR category of each language, and its plural check is one of four that run on every translated string. This section follows the plural forms page and the file formats pages.

Where plural keys come from. A key is a plural key when its source file says so. The formats that carry plurals as separate forms are Android XML (<plurals>), Apple .stringsdict and String Catalogs (plural variations), Flutter ARB (ICU plural messages), gettext PO (msgid_plural), and CSV and XLSX (one row per form, named key[category]). A key can also be marked plural by hand, and it can be switched between plural and simple only while it has no translations.

How they are checked. An AI translation of a plural key writes every form the target language needs. A plural key that is missing a form its language needs fails the plural check. The engine retries once, and if the string still fails it is refused and stays untranslated. The run reports it. Details are on the quality checks page.

How import protects them. A plural entry is written only to a plural key and a simple entry only to a simple key. A mismatch is skipped and reported as a conflict. In most plural formats a category the locale does not use, such as few in an English file, is an import error.

The limits, format by format:

FormatWhat the documentation says
JSON (json_flat, json_nested)No plural construct. An ICU plural inside a value is an ordinary string, stored whole and written back unchanged. The checks read it as ICU according to the project's Message syntax setting, under Settings, then Checks. i18next suffix keys are ordinary keys, each translated on its own, and you add _few or _many keys yourself. Plural keys created in Transglot are left out of a JSON export and counted.
Flutter ARB (flutter_arb)A value shaped like an ICU plural message becomes a plural key. A plural with an exact selector such as =0{...} is kept whole as an ordinary string, and so is a select message. On export the variable is always count.
gettext PO (gettext_po)msgstr[N] is mapped to a category by reading the Plural-Forms header. A three-form Russian, Ukrainian or Polish file maps to one, few and many, and other is filled from many. An unrecognised expression falls back to first form as one and last as other, with a warning.
Android XML (android_xml)Each quantity must be a category the locale uses. A zero or two item in an English file is an import error.
Apple (ios_stringsdict, ios_xcstrings)The stringsdict format key is not kept: text around the variable is not carried, so it belongs in each plural form. In a String Catalog, device and width variations and substitutions are skipped with a warning.
XLIFF 1.2 and 2.0No plural construct. Plural keys are left out of an XLIFF export, and an ICU plural inside a unit is an ordinary string.
YAML, Laravel PHP and JSONNo plural construct. Rails-style one and other keys are ordinary nested keys. Laravel pipe strings are stored as one value.

So for a React or Next.js project on JSON, the plural is an ICU string and the safeguard is the Message syntax setting. For mobile projects the plural is a real plural key with one box per category in the editor. The CLI, the GitHub Action and the API start on the Starter plan, and the Free plan works in the browser console. The mobile localization guide covers the Android and iOS formats end to end.

Transglot's site states that plural handling comes from "224 CLDR plural languages". The count found for this guide is in "How this guide was checked".


Common mistakes

  • Choosing the form with count === 1. It is the English rule. Ask the runtime for the category.
  • Reading category names as numbers. zero in Latvian includes 10, one in Russian includes 21, two in Slovenian includes 102.
  • Leaving the number out of one. "One file" is wrong for 21 files in Russian.
  • Using =1 where one was meant, or zero where =0 was meant. Exact values and categories are different selectors.
  • Giving the target the source's forms. The category list comes from the target language.
  • Omitting other because integers never reach it. Decimals do, and parsers require it.
  • Forgetting many in French, Spanish, Italian and Portuguese. CLDR lists it for whole millions.
  • Treating gettext indexes as categories. msgstr[2] is many in Russian and other in Czech.
  • Selecting on a number that is displayed differently. "1.0" and "1" are different categories in English.
  • Using cardinal rules for ordinals. English "21st" comes from the ordinal rule set.
  • Concatenating around a plural. "You have " + plural + " left" fixes the word order for every language.
  • Testing with 1 and 2 only. Russian needs 1, 2, 5, 11, 21 and a decimal at minimum.
  • Assuming one CLDR version. Vietnamese has one category in CLDR 47 and two in CLDR 49.

Checklist

texttext
Code
[ ] No count === 1 or n != 1 chooses a string anywhere
[ ] No string is built by concatenating around a number
[ ] Every counted message is one key with one full sentence per category
[ ] The number passed to the plural selector has the digits the user sees
[ ] Ordinals use ordinal rules (selectordinal, type: "ordinal")
[ ] Units and lists use Intl.NumberFormat and Intl.ListFormat, not plural keys
Messages
[ ] Every form contains the number placeholder, including "one"
[ ] "No items" wording uses an exact match (=0), not the zero category
[ ] "other" is present in every plural
[ ] Messages with two numbers are split, or nested with full sentences
[ ] select is outside plural where both are needed
[ ] Each key has a description: what is counted, range, decimals or not
Files
[ ] Each target has exactly the categories its language uses
[ ] French, Spanish, Italian, Portuguese have "many"
[ ] PO files: nplurals matches the number of msgstr[n] per entry
[ ] Converted files were mapped per language, not by index
CI and tests
[ ] A script compares every plural with the locale's category list
[ ] Every ICU message parses
[ ] Unit tests render each plural with one number per category
[ ] Test numbers are generated from the runtime, not typed by hand
[ ] The CLDR version of the CI runtime is known
[ ] Screens are measured with the longest form

Frequently asked questions

What are plural rules?

Plural rules are the conditions that decide which grammatical form of a message goes with a given number in a given language. Unicode CLDR publishes them per language, and each rule maps a number to one of six categories: zero, one, two, few, many or other. Software uses them through APIs such as Intl.PluralRules in JavaScript or PluralRules in ICU.

What are the CLDR plural categories?

There are six names: zero, one, two, few, many and other. A language uses only the ones its grammar needs, and other is always present. The names are mnemonics: one in Russian covers 1, 21 and 101, and zero in Latvian covers 0 and 10 to 20.

How many plural forms does Arabic have?

Six. Arabic uses zero for 0, one for 1, two for 2, few for numbers ending in 03 to 10, many for numbers ending in 11 to 99, and other for the rest, such as 100, 101, 102 and decimals. The pattern repeats every hundred, so 103 is few and 111 is many.

What are the Russian plural rules?

Russian has four categories. one is for integers ending in 1 but not 11 (1, 21, 101). few is for integers ending in 2 to 4 but not 12 to 14. many is for integers ending in 0 or 5 to 9, and for 11 to 14. other is for decimals such as 1.5. Ukrainian and Belarusian use the same rule set.

What are the Polish plural rules?

Polish has the same four category names as Russian with one difference: one is only the number 1. So 21, 31 and 101 are many in Polish and one in Russian. few is integers ending in 2 to 4 except 12 to 14, many is the other integers, and other is decimals.

How do plurals work in ICU message format?

An ICU plural is written {count, plural, one {# file} other {# files}}. The library finds the CLDR category of count for the current locale and prints that branch, replacing # with the formatted number. Exact selectors such as =0 are checked before categories, other is required, and selectordinal does the same with ordinal rules.

What is the difference between `=0` and `zero`?

=0 is an exact match for the number 0 and works in every language. zero is a plural category, which only some languages have and which can include other numbers: in Latvian it covers 10, 20 and 30. For a "no items" message use =0.

Why does gettext use `msgstr[0]` instead of category names?

gettext predates the CLDR category names. Each PO file carries a Plural-Forms header with the number of forms and a C expression that turns n into an index, and the translator fills one msgstr[n] per index. The index has no fixed meaning across languages, so converting to a category-based format means evaluating that expression for each language.

How this guide was checked

  • Categories and tables. Every category shown for a number was computed with Intl.PluralRules (select, selectRange, resolvedOptions().pluralCategories) on Node.js 22.15.1, ICU 77.1, CLDR 47. None was written from memory.
  • Rule text. The rules for Polish, Russian, Arabic, the Romance many and the English ordinals were read from plurals.xml and ordinals.xml in the CLDR release-47 tag and compared with release-49. Operand definitions, syntax, explicit 0 and 1 cases and plural ranges follow UTS 35 Part 3, revision 79 (CLDR 49).
  • Language counts. The cardinal plurals.xml lists 222 locale codes in CLDR 47, 227 in CLDR 48 and 228 in CLDR 49. Those totals include root, legacy aliases such as iw and in, and the variants pt_PT and kok_Latn. CLDR 49 groups its 228 codes into 39 rule sets. Transglot's figure of 224 equals the CLDR 48 list without root and the two variants. By the same method CLDR 47 has 220 and CLDR 49 has 225.
  • Scripts. plural-check.mjs and plural-samples.mjs were run on Node 22.15.1 and the outputs shown are the real outputs. The checker used @formatjs/icu-messageformat-parser 3.5.18 on six sample files written for this guide.
  • ICU messages. The ICU examples were parsed with the same parser and evaluated with a small test formatter. They were not run through ICU4J, ICU4C or intl-messageformat.
  • Format samples. The gettext, Android, Apple, Flutter, i18next, Vue I18n, Rails, Laravel and Fluent samples follow each project's documentation. None was compiled or run on its platform. The String Catalog workflow is from Apple's page, and the catalog's JSON shape is not shown because it was not found on the Apple pages read. The PO entry syntax (msgid_plural, msgstr[n]) follows the example on Transglot's gettext format page, because the gettext manual's page on plural entries did not load.
  • Not computed. Compact notation in Intl.PluralRules, because Node 22.15.1 does not apply the option. The table cells marked "Not checked" were not verified in documentation.
  • Word forms. The Russian, Polish and Arabic example forms were written for this guide and were not reviewed by a native speaker. The Slovenian and Lithuanian forms are quoted from ICU and Android documentation.
  • Transglot. Its behaviour is taken from its documentation, not from a test run for this guide. No other localization platform was tested or benchmarked.

Sources

colophon

Who wrote this, and what to read next

wrote this

transglot team

The byline on this post has no profile yet. Author profiles are managed alongside the posts themselves.

Engineering
keep reading

i18next best practices for scalable apps

Scale i18next with deliberate namespaces, correct plural lookups, safe interpolation and explicit fallback rules. Includes working examples and a release checklist.

February 3, 2026
6 min read
keep reading

Automated localization QA with Transglot

Catch broken placeholders, incomplete plurals and terminology conflicts. Learn what automated QA proves, where human review matters and how to validate a release.

March 31, 2026
6 min read
keep reading

How to Localize a Mobile App into 20 Languages Quickly

A five-step plan to take an iOS, Android or Flutter app from one language to twenty: prepare the strings, translate with AI, check plurals and layout, then ship.

November 23, 2026
9 min read
works with what you already run

41 connectors, already built.

the pipeline this post describes

Try it on your own strings. Free, no card.

Free plan: 100,000 words to start (25,000 at sign-up, 75,000 after a phone check), then 10,000 a month, 15 locales including your source, 3 seats.