---
title: "Get plurals right in every language · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/languages-and-regions/plural-rules
updated: 2026-10-20
licence: "All rights reserved"
---

# Get plurals right in every language

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Languages and regions](https://agentwranglers.se/playbook/website/languages-and-regions)
- Rule: Choose plural forms from the language's plural rules instead of adding an "s".
- How: Pick the message for each count from the language's plural rules. Use `Intl.PluralRules` in JavaScript, Babel in Python, or ICU MessageFormat in PHP and Java. Some languages have up to six forms, such as Arabic, so give translators every form the language needs.
- Check: A unit test runs the counts 0, 1, 2, 5 and 21 for each language. Each picks the right form.

Example:

```js
const rules = new Intl.PluralRules('en');
const msg = { one: '# file', other: '# files' };
const label = n => msg[rules.select(n)].replace('#', n);
label(1); // "1 file"
label(3); // "3 files"
```

```python
# Python with Babel
from babel import Locale
english = Locale("en")
messages = {"one": "{n} file", "other": "{n} files"}
label = lambda n: messages[english.plural_form(n)].format(n=n)
label(1)  # "1 file"
```

```php
// PHP with ICU MessageFormat
$files = new MessageFormatter('en', '{n, plural, one {# file} other {# files}}');
echo $files->format(['n' => 3]); // "3 files"
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/languages-and-regions/plural-rules`.

- Previous: [Format dates and numbers for the reader](https://agentwranglers.se/playbook/website/languages-and-regions/locale-content)
- Next: [Translate whole sentences](https://agentwranglers.se/playbook/website/languages-and-regions/whole-sentence-messages)
- [Languages and regions](https://agentwranglers.se/playbook/website/languages-and-regions)
