gettext icon indicating copy to clipboard operation
gettext copied to clipboard

Plural / ngettext support

Open seriyps opened this issue 11 years ago • 3 comments

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

seriyps avatar Feb 11 '14 18:02 seriyps

Hm...note that this gettext lib doesn't have anything in common with GNU gettext (apart from using the PO file format).

etnt avatar Feb 14 '14 12:02 etnt

Still, I agree that such functions would be useful.

richcarl avatar Apr 19 '14 09:04 richcarl

@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.

seriyps avatar Apr 19 '14 14:04 seriyps