About WebTranslateIt.com

WebTranslateIt.com is a web-based translation tool to translate documents and software.

Learn more at WebTranslateIt.com.

Recent posts in the same category

New in WebTranslateIt: Custom plural rules

Posted by Edouard on July 23, 2013

We just released a new feature on WebTranslateIt: custom plural rules. This feature is fairly technical, and will only be useful for developers who need to define their own plural rules.

Plural rules is a feature proposed by some i18n frameworks to help handle the plurals of nouns or unit expressions in different languages.

Some languages have two forms, like English. Some languages have only a single form and some languages have multiple forms.

Plural rules for many languages are listed by the Unicode CLDR project.

WebTranslateIt use CLDR as its reference and when you translate a plural segment from one language to another, WebTranslateIt knows how many text boxes the translation needs.

CLDR’s data is great, but sometimes plural rules in some languages are contested. For instance in Portuguese, Lithuanian, Hungarian, Turkish, Wolof

It’s very difficult to know who’s right and who’s wrong. Hopefully Unicode will handle these issues, verify the claims with experts and fix the rules if they contain mistakes.

In the meanwhile WebTranslateIt follows the CLDR rules, so if you use WebTranslateIt, you also follow this convention.

But what if you disagree and want to use the rule you feel is right?

You can now define your own plural rules. To do so, go to your locales & statistics page, click to edit the language you’d like to change and there, click on “Customize plural rules”.

There, you will be able to edit the plural rule. The plural rule is defined in YAML:

--- 
human:
  other: "0-999, 1.2…"
po:
  nplurals: 1
  plural: "0"
yml:
  other: "everything else"

The above rule defines a language with one unique plural rule: other. Let’s say your translator says that there is actually 2 plural rules: one for when the quantifier equals 1, other otherwise.

You would just have to edit the plural rule to:

--- 
human: 
  one: "1"
  other: "0-999, 1.2…"
po: 
  nplurals: 2
  plural: "n != 1"
yml: 
  one: 1
  other: "everything else"

I hope you will find this new feature useful. Thank you for using WebTranslateIt.