bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] Plural rule definitions


From: Daiki Ueno
Subject: Re: [bug-gettext] Plural rule definitions
Date: Tue, 19 May 2015 18:12:02 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hi Michele,

Sorry for late response.  I didn't forget it, but was thinking about
what is the best way to adopt CLDR in gettext.  Currently we are doing:

0. Mention it in the documentation and guide users to the generated
   plural rules.  I'll do that really soon, before the next release.

1. Update plural-table.c, so a new PO file created with msginit will
   have a usable "Plural-Forms" header.

I think it would be nice if the step 1 is semi-automated somewhere in
gettext, at least in the release procedure.  In order to that, the diff
against the previous plural-table.c should be minimal, so that people
can review the changes easily.  Also, gettext could ship with a helper
program of msginit (like "urlget"), that retrieves the latest CLDR data
if plural-table.c doesn't have a definition.

Michele Locati <address@hidden> writes:

> Yes, that would lead to a more complete languages table. I can easily
> add a new option to automatically generate the plural_table.
> BTW, do you think it could be possible to add more infos to that
> table? I mean, currently gettext offers the number of plurals and the
> formula to distinguish between them, but the only way to know the
> meaning of the different plural cases is to inspect the formula.
> What about adding the CLDR names of the cases and their relative
> examples? I think that it could help many people if the gettext
> headers could be extended to something like this:
> "Language: ar\n"
> "Plural-Forms: nplurals=6; plural=(n == 0) ? 0 : ((n == 1) ? 1 : ((n
> == 2) ? 2 : ((n % 100 >= 3 && n % 100 <= 10) ? 3 : ((n % 100 >= 11 &&
> n % 100 <= 99) ? 4 : 5))));\n"
> "Plural-Case-0: name=zero; examples=0;\n"
> "Plural-Case-1: name=one; examples=1;\n"
> "Plural-Case-2: name=two; examples=2;\n"
> "Plural-Case-3: name=few; examples=3~10, 103~110, 1003, …;\n"
> "Plural-Case-4: name=many; examples=11~26, 111, 1011, …;\n"
> "Plural-Case-5: name=other; examples=100~102, 200~202, 300~302,
> 400~402, 500~502, 600, 1000, 10000, 100000, 1000000, …;\n"

I think it's a good idea, but the format looks a bit too verbose.
Perhaps normal comment lines before the header entry might be
sufficient?  Something like:

# There are 6 different plural forms in this language:
#
#   ・0
#   ・1
#   ・2
#   ・3~10, 103~110, 1003, …
#   ・11~26, 111, 1011, …
#   ・100~102, 200~202, 300~302, 400~402, 500~502, 600, 1000, 10000,
#       100000, 1000000, …
#
# For more details see 
<http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html#ar>.

msgid ""
msgstr ""
...
""

Regards,
-- 
Daiki Ueno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]