gettext
gettext copied to clipboard
Plural / ngettext support
Some support for ngettext(Singular, Plural, Count)
+ evaluator for pluralization rules from Plural-Forms
.po header may be good thing.
Plural-Forms: nplurals=3; \
plural=n%10==1 && n%100!=11 ? 0 : \
n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
Hm...note that this gettext lib doesn't have anything in common with GNU gettext (apart from using the PO file format).
Still, I agree that such functions would be useful.
@richcarl I have gettext rule evaluator implemented there https://github.com/seriyps/gettexter/tree/master/src (see gettexter_plural.erl, gettexter_plural_parser.yrl, gettexter_plural_scanner.xrl).
Rule may be evaluated by erl_eval
or compiled to .beam
.