I18n questions · ICU message format
Nest one argument inside the other so that each combination of gender and count is a full sentence. ICU recommends putting the select on the outside and a single plural inside, because the set of genders is fixed and small while the plural categories vary by language:
With gender set to male and count to 3 this prints He has 3 cats; female and 1 prints She has 1 cat.
The reason for whole sentences is grammar. In many languages the verb, an adjective or the noun agrees with both gender and number, and the word order changes between forms. A translator who receives complete sentences per branch can rewrite each one freely; a translator who receives She, has and cat as separate strings that the code glues together cannot. The ICU user guide puts it as "use complex arguments as the outermost structure of a message, and write full sentences in their sub-messages".
# is replaced only in text that sits directly inside a plural branch, so in the example it always means count. If you nest the other way round, a plural outside and a select inside, ICU prints a # inside the select literally; write {count} there instead, or keep the recommended order.
Keep the nesting to two levels. Every level multiplies the number of sentences a translator has to write: three genders times the four Russian categories is already twelve, and a third dimension such as the item type makes it thirty-six or more. If a message needs that, split it into separate messages or rephrase it so that one variable no longer changes the wording.
Pitfalls:
other branch, or the message fails to parse.}}}} in the example); an editor that validates the syntax, such as the ICU message editor, catches an unbalanced one.female, not Female, or the branch for other is shown.Published Oct 9, 2026 · Markdown version