
ICU MessageFormat: The Grammar Layer of Web i18n
Hard-coded singular/plural logic is wrong in many languages. How ICU MessageFormat moves grammar inside the message: CLDR plurals, select, nesting, and MessageFormat 2.0 status.
TL;DR: String interpolation breaks in most of the languages that Unicode CLDR's plural rules cover, because plural forms, gender, and word order are grammar — and grammar belongs inside the message, not in application code. This article covers ICU MessageFormat at working level: CLDR plural categories, select and nesting, the authoring rules that keep messages translatable, and an honest status ledger for MessageFormat 2.0 and the native JavaScript proposal, still at Stage 1.
Why interpolation is not enough
Many teams that internationalize a product replay the same short tragedy. The code says You have ${count} items. Someone notices "You have 1 items" and adds an if-else for the singular. English is now correct, the pattern ships everywhere, and the codebase quietly commits to a false assumption: that every language splits counts the way English does.
Many do not. In Unicode CLDR's plural data, some languages need three to six categories, some need only one, and even some languages with two categories draw the line elsewhere — Hindi, for example, puts 0 in the same category as 1. For whole numbers, Russian uses one form for 1, another for 2 through 4, and a third for 5 and beyond — and the pattern repeats for 21, 22, 25; CLDR adds a fourth category for fractions. Arabic distinguishes six grammatical plural categories. Japanese uses one form for every count. A hand-rolled count === 1 branch is not a simplification of this reality; it is a hardcoded claim about English, silently wrong in many locales the product may ship. And plurals are only the loudest case — gendered nouns, formal and informal address, and word order vary the same way.
The insight that ICU MessageFormat encodes is that this variation is grammatical, so it must live inside the message, where each locale's translator can express their language's rules — not in application code, which would need a branch per language per grammatical feature. The code supplies values; the message decides how they read. ICU MessageFormat is a long-established syntax for expressing this, implemented in ICU itself. Among web i18n libraries, FormatJS (react-intl) uses it, while i18next and Vue I18n use their own message syntax by default — i18next supports ICU through its i18next-icu plugin (as of Nov 2026 — the landscape article on this topic covers who speaks what).
The scope line for this article: message syntax and authoring. How keys are named and organized is the key-architecture article's territory; the APIs that format raw dates and numbers per locale are the Intl article's. A message treats those as placeholder values — this article is about the grammar wrapped around them.
Plurals the CLDR way
ICU plural messages work because someone already did the linguistics. Unicode CLDR's plural rules define, for each language CLDR covers, which counts belong to which grammatical category — and there are exactly six category names: zero, one, two, few, many, and other.
The names are traps for the intuition, so the point deserves emphasis: these are grammatical classes, not quantities. In Russian, 21 belongs to the one category, because 21 takes the same noun form as 1. Welsh puts 6 in many. English uses only one and other; a language like Arabic uses all six. Which categories a locale needs, and which numbers fall into each, is CLDR's job — never the developer's, and never an if-else's. The only category every message must supply in every locale is other, the universal fallback.
Here is a working plural message:
cart.itemCount:
{count, plural,
=0 {Your cart is empty}
one {# item in your cart}
other {# items in your cart}
}Three mechanics worth reading closely. The #, written directly in a branch, is a placeholder for the count itself (less any offset, and this message sets none), formatted as a number in the message's locale. The =0 branch is an exact match, and it is doing something different from a grammatical category: grammatical zero belongs to a category (other in English), while =0 is a designed empty state — "Your cart is empty" is a product decision, not a plural form. Exact matches are how the two coexist. And the branch set shown is the English branch set: when this message reaches a Polish translator, they supply one, few, many, and other branches, because that is what Polish grammar requires — the source message does not change, and the code does not know the difference.
That last point is the division of labor that makes the whole system work: engineers author the source-language branches and the placeholder contract; translators own each locale's branch set; CLDR decides which branches each locale needs.
Ordinals get the same treatment through a sibling rule set. "1st, 2nd, 3rd" follows different rules than cardinal counting — English needs one/two/few/other for ordinals (1st, 2nd, 3rd, 4th) despite needing only two cardinal categories. ICU expresses this with selectordinal, and CLDR again carries the per-locale rules.
Select, gender, and nesting
Plurals vary on a number. The other axis of grammatical variation is a closed set of named cases, and ICU expresses it with select:
invite.sent:
{hostGender, select,
female {She invited you to the workspace}
male {He invited you to the workspace}
other {They invited you to the workspace}
}select is for enumerable grammar and enumerable UI states: grammatical gender, formal versus informal address, a status field with three known values. The other branch is mandatory here too — it is the rail that keeps an unexpected value from rendering nothing.
What never goes into a select: open-ended data. User names, product titles, and city names are plain placeholders — content, not grammar. A select branch per product category is a catalog masquerading as a message, and it will break the first time the data grows a value the message never heard of.
The two mechanisms nest, for messages that vary on both axes:
files.shared:
{ownerGender, select,
female {{count, plural,
one {She shared # file with you}
other {She shared # files with you}}}
male {{count, plural,
one {He shared # file with you}
other {He shared # files with you}}}
other {{count, plural,
one {They shared # file with you}
other {They shared # files with you}}}
}This is legitimate and common — and it is also the honest warning: branches multiply. Three gender branches and two plural forms is six leaves in English, as in the sample above; a locale with three genders and four plural categories maintains twelve. When a message needs a third axis, the answer is almost never deeper nesting — it is splitting the message at the design level, because a message doing too much translates badly and reviews worse.
One more capability deserves a sentence rather than a section: some web implementations, FormatJS among them, support rich-text placeholders — tags inside messages that the UI layer maps to real markup — so that "Read the <link>terms</link>" stays one translatable sentence instead of three fragments glued around an anchor. The syntax is library-specific; the principle is the same anti-concatenation rule this topic keeps returning to.
Authoring rules that keep messages translatable
The syntax is the easy half. Much translation damage is done at authoring time, in the source language, by messages that were never translatable to begin with. Four rules guard against it.
Whole sentences, not fragments. The W3C's composite-messages guidance makes the structural argument: word order is a per-language variable, so a placeholder must be free to move anywhere in the sentence. Text assembled from fragments in code freezes English word order into the product. Every complete thought is one message; if two strings are always rendered glued together, they are one message.
One thought per message. A message that embeds two sentences, a conditional clause, and a parenthetical becomes a wall of branches once plural and select arrive. Two messages composed in layout beat one message doing the work of three — for the translator, for the reviewer, and for whoever debugs it in a locale they cannot read.
Placeholder discipline. Named placeholders ({itemCount}, never {0}), a stated type for each — number, date, string — in the key's context metadata, and no HTML assembled by string-joining around a message. The type matters because it tells the translator what the value will look like inline, and it tells the message layer which formatter (the Intl article's territory) renders it.
Source-language quality is an engineering input. An ambiguous English source — "Archive" the noun or "Archive" the verb? — produces ambiguous branches in every locale at once, and the ambiguity is invisible until a native reader hits it in production. The description metadata from the key-architecture article is where the disambiguation lives, written by the person who knew the answer at authoring time.
MessageFormat 2.0, honestly
Classic ICU MessageFormat is old enough to have a designed successor, and the status deserves precise dates rather than vibes — the claims below are as of November 2026 and worth re-verifying against the primary sources linked.
Unicode MessageFormat 2.0 (MF2) is a stable specification, apart from functions and options still marked Draft, which as of CLDR 49 (October 2026) include the date and time functions and :unit. After a multi-year working-group process, MF2 advanced from Final Candidate to Stable in LDML 47 (March 2025); it is Part 9 of the Unicode LDML specification, with maintenance revisions continuing in subsequent releases. Under that part's stability policy, functions and options marked Draft are not stable, and they might change or be removed before being declared Stable. It is a genuine redesign: a cleaner syntax, declarations, a matcher construct generalizing plural and select, and first-class markup — built by the Unicode MessageFormat working group with cross-platform consistency as an explicit goal.
Adoption is early. A stable spec is not a production default. As of Nov 2026, ICU-based web i18n libraries such as FormatJS still use classic ICU MessageFormat syntax, while others, such as i18next and Vue I18n, default to their own formats. MF2 implementations exist across several platforms; check your framework's and library's documentation for MF2 support before planning around it. And the proposal to build MF2 formatting natively into JavaScript — Intl.MessageFormat — remains at Stage 1 of the TC39 process; its champion told the committee in April 2024 that the proposal was stuck, although other delegates at that meeting said they did not see it as stuck or at an impasse. The champion relayed the conclusion reached after concerns raised in the TC39 plenary and in TG2, its internationalization task group: to standardize the syntax, it would be "meaningful/persuasive" to see around a dozen organizations of various sizes, including ones not involved in MF2 development, make significant production use of MF2 syntax across their stack (engaging application developers, translators and infrastructure developers). That experience will likely be required for Stage 2.7, and whether a smaller amount would be enough for Stage 2 remained to be defined. As of Nov 2026 the proposal README still lists Stage 1, which means there is no native, library-free message layer coming soon enough to wait for.
What a team should do with this today is pleasantly boring. Author in classic ICU MessageFormat — it is the syntax that ICU-based libraries such as FormatJS run today, and tooling that compiles ICU MessageFormat 1 sources into MF2 formatters already exists (for example, the @messageformat/icu-messageformat-1 package, still pre-1.0 as of Nov 2026). Keep message rendering behind your own thin seam (the library-selection article on this topic makes the full argument), so a future MF2 migration touches one module and a catalog conversion rather than every component. Evaluate MF2 when your chosen library ships stable support for it, and not before. Nothing about the transition is a reason to defer internationalization work now.
The durable comfort under all of it: the concepts in this article are not tied to either syntax. CLDR plural categories, the grammar-in-the-message principle, mandatory fallback branches, and the authoring rules carry over to MF2: its specification requires every .match to include at least one variant whose keys are all the catch-all *, and says plural selection should use CLDR plural rule data, while the meaning of the plural keywords is locale-dependent and implementation-defined. Learn the grammar layer once, and the syntax it wears is a detail. The messages a team authors carefully today are what MF1-to-MF2 tooling is built to convert; the if-else plurals in code are not.