DEV Community

Cover image for Plural forms in translations: ICU messages and CLDR
Georgi Kalchev
Georgi Kalchev

Posted on Originally published at aiskills402.com

Plural forms in translations: ICU messages and CLDR

English needs two plural forms, Arabic needs six. How ICU MessageFormat and the CLDR categories decide which word form a number gets, and how to check it.

A message such as "3 files" looks trivial until it is translated. Each language decides which form of the noun, and sometimes of the verb, a given number requires, and a string built by adding an "s" to a word cannot express that. The standard answer is a plural message: one string per language that lists the forms and lets a library choose among them using rules published by the Unicode CLDR project. This guide explains how the categories work, how the ICU message syntax uses them, where hand-written messages go wrong, and how to test a message against the real rules of a runtime.

Read the full report on AISkills402: https://aiskills402.com/blog/icu-plural-messages-cldr-rules?utm_source=devto&utm_medium=social

Top comments (0)