# Text that's surprisingly hard to translate: 3 pluralization mistakes that are messing up your code

> After recently internationalizing our codebase, we’d like to share 3 common mistakes to avoid when using pluralization logic in your application.

Source: https://asana.com/inside-asana/three-pluralization-mistakes-messing-code

## Three pluralization mistakes that are messing up your code

We recently worked to [internationalize the Asana codebase](https://blog.asana.com/2017/11/asana-available-new-languages-french-german/), and we learned a lot about how to write dynamically pluralized text. We’d like to share three common mistakes that you can avoid the next time you need to use pluralization logic in your application.

## 1 – You forgot to handle irregular pluralization

buggyPluralize(2, “email”);

&amp;gt; “emails”

If your pluralization function just appends an “s” to an input string, then we’ve got bad news for you. Your code is probably telling users that they have “3 boxs” arriving next week, or that they can click a button to “Roll 5 dices”.

You can fix this problem in English by making your pluralization function by always explicitly stating your singular and plural forms:

okayPluralize(3, “box”, “boxes”);

&amp;gt; “boxes”

That’s much better Let’s learn about another mistake.

## 2 – You thought that one was the only loneliest number

Let’s say you’re internationalizing your code and have a `translate` function, which looks up the translated version of the passed-in string:

okayPluralize(0, translate(“answer”), translate(“answers”));

&amp;gt; “réponse”

You might think that you’re generating the string “0 answers” in French, but you’re actually creating something grammatically incorrect. Unlike English, French uses the singular form for 0! To a French reader, your sentence will look as incorrect as “You got 0 answer right” does in English.

## 3 – You assumed there were only two plural forms

This is when pluralization gets even more interesting. It turns out, some languages have [more than two](https://www.arabeyes.org/Plural_Forms) plural forms. Arabic, Russian, Czech, and Polish all have more than two plural forms. It’s important that your type signature for okayPluralize be able to handle that.Here some interesting pluralization cases which are used in Arabic:
- numbers that end with a number between 3 and 10 (like: 103, 1405, 23409)
- numbers that end with a number between 11 and 99 (like: 1099, 278)
- numbers above 100 ending with 0, 1 or 2 (like: 100, 232, 3001)

We hope that this convinces you to centralize your pluralization logic into a small, correct module instead of sprinkling it throughout your codebase!

## You need a system for text

Even if your product is only in English, you can outright prevent a bunch of technical debt by internationalizing your code as soon as it’s developed. Code goes in your codebase, and data goes into your database. So why not have a textbase?If you’re using a framework with built-in support for internationalization, we highly recommend leveraging that support. There are also tons of [open-source solutions](http://airbnb.io/polyglot.js/polyglot.html) that you can integrate into your codebase.Internationalization might not be on the short-term roadmap for your project. However, it’s much easier to do it as you develop new code instead rather than trying to build it into a legacy codebase later.

- [Microframeworks in the Admin Console](/fr/inside-asana/microframeworks-admin-console)

ingénierie

Chaque mise en œuvre d'Asana dispose d'une console d'administration. C'est là que les administrateurs informatiques configurent la façon dont leur entreprise utilise Asana, par ex ...

- [Développement axé sur les spécifications : les points positifs et ce que nous avons appris après trois mois](/fr/inside-asana/spec-driven-development)

ingénierie

#### Ingénieur logiciel permanent

Au bout de trois mois, nous avions une vision plus claire des situations dans lesquelles la structure ajoutée était utile et de celles où elle constituait un frein.L'un de nos ing ...

- [Nous avons migré hors d'Enzyme en deux semaines. Cela aurait dû prendre cinq ans](/fr/inside-asana/migrating-off-enzyme-2-weeks)

ingénierie

Nous avons récemment utilisé l'IA pour terminer des années de travail d'ingénierie en un sprint environ. Voici comment et pourquoi cela a changé notre façon de penser ce qui est p ...

- [Comment les AI Teammates créent de la mémoire : transformer le travail en connaissances réutilisables](/fr/inside-asana/ai-teammates-turn-work-into-reusable-information)

Intelligence artificielle (IA)

ingénierie

La plupart des produits d'IA traitent la mémoire comme une fonctionnalité personnelle : ils se souviennent de faits concernant un utilisateur ou une discussion. Mais une IA qui co ...

- [Three pluralization mistakes that are messing up your code](/fr/inside-asana/three-pluralization-mistakes-messing-code)

ingénierie

We recently worked to internationalize the Asana codebase, and we learned a lot about how to write dynamically pluralized text. We’d like to share three common mistakes that you c ...

- [ingénierie](/inside-asana/engineering-spotlight)
