---
title: "How do I combine gender and count in one ICU message?"
description: "Nest a plural inside a select so every gender and count combination is a full sentence, for example `{gender, select, female {{count, plural, one {She has # cat} other {She has # cats}}} male {...} other {...}}`. Keep nesting to two levels and never build the sentence from fragments in code."
category: icu-message-format
date: 2026-10-09
canonical: https://localizely.com/i18n-questions/icu-message-format/how-do-i-combine-gender-and-count-in-one-icu-message/
---

# How do I combine gender and count in one ICU message?

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:

```icu-message-format
{gender, select,
  female {{count, plural, one {She has # cat} other {She has # cats}}}
  male {{count, plural, one {He has # cat} other {He has # cats}}}
  other {{count, plural, one {They have # cat} other {They have # cats}}}}
```

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](https://unicode-org.github.io/icu/userguide/format_parse/messages/) 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:

- Every level needs its own `other` branch, or the message fails to parse.
- The closing braces pile up at the end (`}}}}` in the example); an editor that validates the syntax, such as the [ICU message editor](/icu-message-editor/), catches an unbalanced one.
- A select value must match the keyword exactly, so pass `female`, not `Female`, or the branch for `other` is shown.

Source: https://localizely.com/i18n-questions/icu-message-format/how-do-i-combine-gender-and-count-in-one-icu-message/
