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

- [Being a Female Engineer at Asana](/ru/inside-asana/female-engineer)

Engineering

Note: This post was originally published on Quora in response to the question What are some particularly female-engineer-friendly companies to work for in San Francisco?As a femal ...

- [Scaling our invalidation pipeline: Part 1](/ru/inside-asana/scaling-invalidation-pipeline-part-1)

Engineering

#### Platform Engineer

At Asana, our invalidation pipeline is a key part of implementing near-realtime reactivity in the webapp. Reactivity is how each-and-every Asana tab keeps up-to-date with the lat ...

- [AI Agents Built for Teams: Shared Context and Transparency in Enterprise AI](/ru/inside-asana/ai-agents-built-for-teams-context-transparency)

Engineering

Artificial Intelligence (AI)

The Accountability gap Enterprise AI agents are AI systems that can take actions inside shared workflows across teams and projects. This landscape has grown quickly as a growing l ...

- [Scaling LunaDb, our in-house declarative data loading system](/ru/resources/scaling-lunadb)

Engineering

#### Platform Engineer

Here at Asana, we’ve built a data loading system called LunaDb that serves as the backbone of our webapp. Despite the name, it’s not a database. Rather, it’s a GraphQL-like system ...

- [Three pluralization mistakes that are messing up your code](/ru/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)
