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

- [我們如何透過保持快取完整無損，將瀏覽器代理程式的成本降低 76 倍，並使其速度提升 5 倍](/zh-tw/inside-asana/cut-browsers-agent-cost)

工程

人工智慧 (AI)

#### StackAI 的技術長

一項在 Codex 中使用 GPT-6 Astra 的研究，涵蓋四種模型，從調查程式碼到評估結果。為什麼我們要研究Asana 正透過 StackAI 將代理程式工作流程自動化引入其平台，而在 Asana 的規模下，小小的效率低下問題會累積起來。 我們的目標是讓一個瀏覽器代理程式更便宜、更快，同時不降低答案品質。「這就是人類和代理程式團隊在實務上的運作方式。 ...

- [系統管理主控台中的微型架構](/zh-tw/inside-asana/microframeworks-admin-console)

工程

每個 Asana 部署都有一個系統管理主控台。 IT 系統管理員可以在此處設定公司使用 Asana 的方式，例如調整密碼要求、角色和權限、是否可以從 Dropbox 附加檔案，以及在預設情況下誰可以看見新專案。隨著 Asana 的發展，系統管理主控台累積了多年的自訂邏輯和臨時拼湊的解決方案，導致建立和維護管理控制項的成本越來越高。 以其中一項管理設定為例： ...

- [以規格為導向的開發：優點以及我們在三個月後學到的內容](/zh-tw/inside-asana/spec-driven-development)

工程

#### 主任軟體工程師

三個月後，我們更清楚地瞭解了新增的架構在何時有幫助，以及在何時成為阻礙。我們的一位工程師正在準備資料遷移，並決定使用規格導向開發 (SDD) 來規劃工作。 SDD 的用意是幫助他們及早發現疏漏，使方法更易於審查，並為客服人員提供明確的方向。 最終的計劃非常詳細，從紙面上看來相當合理。 它將工作組織如下：問題 → 研究 → 規格 → 審查 → 實施 → 驗證 ...

- [我們在 2 週內完成了 Enzyme 遷移。這本應花費五年的時間。](/zh-tw/inside-asana/migrating-off-enzyme-2-weeks)

工程

我們最近使用 AI，在大約一次衝刺中完成了多年的工程工作。 以下是其方法，以及為什麼它改變了我們對可能性的看法。五年問題早在 2022 年，我們就著手將 Asana 的前端測試套件從我們老舊的測試庫 Enzyme 移轉至 React Testing Library (RTL)。 Enzyme 已經失去社群支援，無法與較新版本的 React 正常搭配，並且鼓 ...

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

工程

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

- [工程](/inside-asana/engineering-spotlight)
