Obviously users like to see text properly pluralized, and pluralization schemes vary in the various written languages one may encounter. When internationalizing an app, what pattern(s) are useful for handling messages with possible pluralization? What about messages with multiple possible pluralization?

For example: "N review(s):"

One pattern would be

reviews.title.singular="{0} review:"
reviews.title.plural="{0} reviews:"

And this may not support all languages.

Or a more complicated case: "Found M question(s) with N comment(s)."

This would be difficult to support even in English.

  • Did you mean to say "reviews.title.plural" for your second property?
    – jmort253
    Nov 3, 2013 at 20:45

3 Answers 3


the pattern I have seen used is to create a specific pattern for it with describes the ranges of each value

for example in java it is

"Found {0,choice,0#no questions|1#a single question|1<{0,number,integer} questions} with "+
"{1,choice,0#no comments|1#a single comment|1<{1,number,integer} comments}."

it is a pain for something like that but fully translatable to languages with odd rules

  • I didn't know MessageFormat could do that... and since Java 6 even. The hoops we jump to because we don't have the whole language at runtime 🙂 Jan 4, 2022 at 10:29

The approach taken by GNU gettext is to defer most of the handling of the various plural forms to the file containing the translations themselves. To retrieve a translated string that might involve pluralization, you make a call like

ngettext("singular English form", "plural English form", quantity)

and the library will select the right plural form based on the value of quantity and the language-specific rules for the various plural forms.

To avoid a combinatorial explosion, this scheme can only handle a single quantity that might trigger pluralisation. If you have multiple quantities that might trigger pluralisation, I would try to either rephrase the message such that the multiple pluralisation is removed or split it into multiple chunks that get translated (and pluralised) separately.


Solutions like the ones described in the other answers may work, but are IMO quite complicated to implement when you're dealing with a great number of different phrases, several pluralized words in the same phrase and so on.
It gets even worse when you have languages with more complex plural rules, as described here.

At work, we're dealing with stuff like this as well (in 5 languages, for now).
What we do: We try to avoid all that complexity by writing our messages either exactly like the examples in your question:

Found M question(s) with N comment(s).

...or like this:

Number of questions found: M
Number of comments found: N

Of course this doesn't look as elegant as the output of the more complex solutions, but it's much, much easier to deal with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.