mozilla-b2g/gaia — pull request #1511 by fabi1cazenave (2012-05-28 20:30:53+00:00)
Title: [l10n] support plural forms

There are two strings in Gaia for which it’d be nice to support specific plural forms:

```properties
unreadMessages=You have {{n}} unread messages
missedCalls=You have {{n}} missed calls
```

Here’s a syntax proposal to support plural forms that would be compatible with:

* the good old `*.properties` syntax
* JetPack’s syntax for plural forms
* the “LOL” approach (i.e. macros + indexes + hash tables)

```properties
unreadMessages={[ plural(n) ]}
unreadMessages[zero] = You have no unread messages
unreadMessages[one] = You have one unread message
unreadMessages[other] = You have {{n}} unread messages
```

Here, `plural()` is a pre-defined macro that returns zero|one|two|few|many|other, depending on the language and the value of `n`, as specified in the [Unicode plural rules](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html).

This `plural()` macro is pre-defined in webapi.js. It should be easy to override it by a user-defined macro when the Mozilla LOL expression parser is available; note that at the moment, we don’t need any other macro for Gaia.