# 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.

- [Inside Asana's Database Architecture: Sharding, Data Flow, and Scaling Tradeoffs](/inside-asana/database-architecture-sharding-scaling)

Engineering

At Asana, changes to work appear in real time across the product by default. That responsiveness increases database traffic and pushes our databases toward their scaling limits as ...

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

Engineering

Every Asana deployment has an admin console. It's where IT admins configure how their company uses Asana, such as adjusting password requirements, roles and permissions, whether f ...

- [Spec-driven development: The Good Parts - and what we learned after three months](/inside-asana/spec-driven-development)

Engineering

#### Staff Software Engineer

After three months, we had a clearer picture of when the added structure helped and when it got in the way.One of our engineers was preparing a data migration and decided to use s ...

- [We migrated off Enzyme in 2 weeks. It should have taken five years.](/inside-asana/migrating-off-enzyme-2-weeks)

Engineering

We recently used AI to complete years of engineering work in about one sprint. Here's how, and why it's changed how we think about what's possible.The five-year problemBack in 202 ...

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

Engineering

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 ...

- [Engineering](/inside-asana/engineering-spotlight)
