bug-gettext
[Top][All Lists]
Advanced

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

[bug #66378] cldr-plurals fails to parse recent CLDR data: 1c6, ...


From: Michele Locati
Subject: [bug #66378] cldr-plurals fails to parse recent CLDR data: 1c6, ...
Date: Fri, 25 Oct 2024 08:40:09 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?66378>

                 Summary: cldr-plurals fails to parse recent CLDR data: 1c6,
...
                   Group: GNU gettext
               Submitter: mlocati
               Submitted: Fri 25 Oct 2024 02:40:04 PM CEST
                Category: Plural forms
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 25 Oct 2024 02:40:04 PM CEST By: Michele Locati <mlocati>
msginit may use cldr-plurals to generate plural rules starting from the
common/supplemental/plurals.xml file provided by CLDR.

For example, from this chunk of CLDR v37 data

<pluralRules locales="ff fr hy kab">
  <pluralRule count="one">i = 0,1 @integer 0, 1 @decimal 0.0~1.5</pluralRule>
  <pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1000000,
… @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0,
…</pluralRule>
</pluralRules>


cldr-plurals generates this rule for French:

nplurals=2; plural=(n > 1);


This allows 2 different plural translations like:
- 1 page
- 2 pages

Since CLDR v38 they extended the format of the plurals.xml file [1]:

<pluralRules locales="fr">
  <pluralRule count="one">i = 0,1 @integer 0, 1 @decimal 0.0~1.5</pluralRule>
  <pluralRule count="many">e = 0 and i != 0 and i % 1000000 = 0 and v = 0 or e
!= 0..5 @integer 1000000, 1e6, 2e6, 3e6, 4e6, 5e6, 6e6, … @decimal
1.0000001e6, 1.1e6, 2.0000001e6, 2.1e6, 3.0000001e6, 3.1e6, …</pluralRule>
  <pluralRule count="other"> @integer 2~17, 100, 1000, 10000, 100000, 1e3,
2e3, 3e3, 4e3, 5e3, 6e3, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0,
100000.0, 1000000.0, 1.0001e3, 1.1e3, 2.0001e3, 2.1e3, 3.0001e3, 3.1e3,
…</pluralRule>
</pluralRules>


This is used to add a third translation for 1000000, 1e6 (1 million expressed
for example like 1M), and so on.
For example, we can now have 3 translations like:
- 1 page
- 1M de pages
- 2 pages

PS: More and more languages are using this new syntax in later CLDR versions
(as of v46 we have: ca, es, fr, it, lld, pt, pt_PT, scn, vec).

The problem is that cldr-plurals can't parse this new format:

$ cldr-plurals -c fr /cldr-46/common/supplemental/plurals.xml
one: i = 0,1 @integer 0, 1 @decimal 0.0~1.5; many: e = 0 and i != 0 and i %
1000000 = 0 and v = 0 or e != 0..5 @integer 1000000, 1c6, 2c6, 3c6, 4c6, 5c6,
6c6, … @decimal 1.0000001c6, 1.1c6, 2.0000001c6, 2.1c6, 3.0000001c6, 3.1c6,
…; other:  @integer 2~17, 100, 1000, 10000, 100000, 1c3, 2c3, 3c3, 4c3, 5c3,
6c3, … @decimal 2.0~3.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0,
1.0001c3, 1.1c3, 2.0001c3, 2.1c3, 3.0001c3, 3.1c3, …

$ cldr-plurals fr /cldr-46/common/supplemental/plurals.xml
syntax error
cldr-plurals.exe: cannot parse CLDR rule



[1] https://cldr.unicode.org/downloads/cldr-38#h.7ahoxbsngtxp_l








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66378>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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