mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/language-data.git
synced 2025-10-03 15:01:09 +08:00
fix: wrong plural counts for some numbers
This commit is contained in:
parent
a96f562e39
commit
c10f6dea89
6 changed files with 35 additions and 24 deletions
|
@ -411,7 +411,7 @@ The Plurals column lists data in languages.csv which is used in Weblate
|
||||||
| ljp | Lampung Api | nplurals=2; plural=n != 1; | | | | |
|
| ljp | Lampung Api | nplurals=2; plural=n != 1; | | | | |
|
||||||
| lki | Laki | nplurals=2; plural=n != 1; | | | | |
|
| lki | Laki | nplurals=2; plural=n != 1; | | | | |
|
||||||
| lkt | Lakota | nplurals=1; plural=0; | ✔ | | | |
|
| lkt | Lakota | nplurals=1; plural=0; | ✔ | | | |
|
||||||
| lld | Ladin | nplurals=2; plural=(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2); | ✔ | | | |
|
| lld | Ladin | nplurals=3; plural=(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2); | ✔ | | | |
|
||||||
| lmn | Lambadi | nplurals=2; plural=n != 1; | | | | |
|
| lmn | Lambadi | nplurals=2; plural=n != 1; | | | | |
|
||||||
| lmo | Lombard | nplurals=2; plural=n != 1; | | | | |
|
| lmo | Lombard | nplurals=2; plural=n != 1; | | | | |
|
||||||
| ln | Lingala | nplurals=2; plural=n > 1; | ✔ | | ✔ | ✔ |
|
| ln | Lingala | nplurals=2; plural=n > 1; | ✔ | | ✔ | ✔ |
|
||||||
|
@ -602,7 +602,7 @@ The Plurals column lists data in languages.csv which is used in Weblate
|
||||||
| sat | Santali | nplurals=3; plural=n == 1 ? 0 : n == 2 ? 1 : 2; | ✔ | | nplurals=2; plural=(n != 1); | nplurals=2; plural=(n != 1); |
|
| sat | Santali | nplurals=3; plural=n == 1 ? 0 : n == 2 ? 1 : 2; | ✔ | | nplurals=2; plural=(n != 1); | nplurals=2; plural=(n != 1); |
|
||||||
| sc | Sardinian | nplurals=2; plural=n != 1; | ✔ | | | |
|
| sc | Sardinian | nplurals=2; plural=n != 1; | ✔ | | | |
|
||||||
| sck | Sadri | nplurals=2; plural=n != 1; | | | | |
|
| sck | Sadri | nplurals=2; plural=n != 1; | | | | |
|
||||||
| scn | Sicilian | nplurals=2; plural=(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2); | ✔ | | | nplurals=2; plural=(n != 1); |
|
| scn | Sicilian | nplurals=3; plural=(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2); | ✔ | | | nplurals=2; plural=(n != 1); |
|
||||||
| sco | Scots | nplurals=2; plural=n != 1; | | | ✔ | ✔ |
|
| sco | Scots | nplurals=2; plural=n != 1; | | | ✔ | ✔ |
|
||||||
| sd | Sindhi | nplurals=2; plural=n != 1; | ✔ | | ✔ | ✔ |
|
| sd | Sindhi | nplurals=2; plural=n != 1; | ✔ | | ✔ | ✔ |
|
||||||
| sdh | Kurdish (Southern) | nplurals=2; plural=n != 1; | ✔ | | | |
|
| sdh | Kurdish (Southern) | nplurals=2; plural=n != 1; | ✔ | | | |
|
||||||
|
|
|
@ -20,3 +20,4 @@ lv,Latvian,3,(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1
|
||||||
se,Sami (Northern),2,(n != 1)
|
se,Sami (Northern),2,(n != 1)
|
||||||
sl,Slovenian,4,(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)
|
sl,Slovenian,4,(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0)
|
||||||
ro_MD,Moldavian,3,(n == 1) ? 0 : ((n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) ? 1 : 2)
|
ro_MD,Moldavian,3,(n == 1) ? 0 : ((n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) ? 1 : 2)
|
||||||
|
scn,Sicilian,2,n != 1
|
||||||
|
|
|
|
@ -405,7 +405,7 @@ lij,Ligurian,2,n != 1
|
||||||
ljp,Lampung Api,2,n != 1
|
ljp,Lampung Api,2,n != 1
|
||||||
lki,Laki,2,n != 1
|
lki,Laki,2,n != 1
|
||||||
lkt,Lakota,1,0
|
lkt,Lakota,1,0
|
||||||
lld,Ladin,2,(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)
|
lld,Ladin,3,(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)
|
||||||
lmn,Lambadi,2,n != 1
|
lmn,Lambadi,2,n != 1
|
||||||
lmo,Lombard,2,n != 1
|
lmo,Lombard,2,n != 1
|
||||||
ln,Lingala,2,n > 1
|
ln,Lingala,2,n > 1
|
||||||
|
@ -596,7 +596,7 @@ sas,Sasak,2,n != 1
|
||||||
sat,Santali,3,n == 1 ? 0 : n == 2 ? 1 : 2
|
sat,Santali,3,n == 1 ? 0 : n == 2 ? 1 : 2
|
||||||
sc,Sardinian,2,n != 1
|
sc,Sardinian,2,n != 1
|
||||||
sck,Sadri,2,n != 1
|
sck,Sadri,2,n != 1
|
||||||
scn,Sicilian,2,(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)
|
scn,Sicilian,3,(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)
|
||||||
sco,Scots,2,n != 1
|
sco,Scots,2,n != 1
|
||||||
sd,Sindhi,2,n != 1
|
sd,Sindhi,2,n != 1
|
||||||
sdh,Kurdish (Southern),2,n != 1
|
sdh,Kurdish (Southern),2,n != 1
|
||||||
|
|
|
19
scripts/lint
19
scripts/lint
|
@ -5,6 +5,8 @@
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
from gettext import c2py
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
|
|
||||||
def parse_csv(name):
|
def parse_csv(name):
|
||||||
|
@ -59,3 +61,20 @@ for match in matching:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Mismatching plural form for {match}: {plural_our!r} != {plural_cldr!r}"
|
f"Mismatching plural form for {match}: {plural_our!r} != {plural_cldr!r}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Validate plural count
|
||||||
|
for code, _name, plural_count, plural_formula in languages.values():
|
||||||
|
plural = c2py(plural_formula)
|
||||||
|
# Get maximal plural
|
||||||
|
calculated = (
|
||||||
|
max(
|
||||||
|
plural(x)
|
||||||
|
for x in chain(range(-10, 200), [1000, 10000, 100000, 1000000, 10000000])
|
||||||
|
)
|
||||||
|
+ 1
|
||||||
|
)
|
||||||
|
if calculated != int(plural_count):
|
||||||
|
raise ValueError(
|
||||||
|
f"Mismatching plural count for {code}: {plural_count} != {calculated}"
|
||||||
|
)
|
||||||
|
|
|
@ -3676,7 +3676,7 @@ LANGUAGES = (
|
||||||
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
||||||
# or other variant.
|
# or other variant.
|
||||||
_("Ladin"),
|
_("Ladin"),
|
||||||
2,
|
3,
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -5395,7 +5395,7 @@ LANGUAGES = (
|
||||||
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
||||||
# or other variant.
|
# or other variant.
|
||||||
_("Sicilian"),
|
_("Sicilian"),
|
||||||
2,
|
3,
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -205,6 +205,15 @@ EXTRAPLURALS = (
|
||||||
3,
|
3,
|
||||||
"(n == 1) ? 0 : ((n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) ? 1 : 2)",
|
"(n == 1) ? 0 : ((n == 0 || n != 1 && n % 100 >= 1 && n % 100 <= 19) ? 1 : 2)",
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"scn",
|
||||||
|
# Translators: Language name for ISO code "scn". The parenthesis clarifies
|
||||||
|
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
||||||
|
# or other variant.
|
||||||
|
_("Sicilian"),
|
||||||
|
2,
|
||||||
|
"n != 1",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
CLDRPLURALS = (
|
CLDRPLURALS = (
|
||||||
|
@ -289,15 +298,6 @@ CLDRPLURALS = (
|
||||||
3,
|
3,
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"lld",
|
|
||||||
# Translators: Language name for ISO code "lld". The parenthesis clarifies
|
|
||||||
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
|
||||||
# or other variant.
|
|
||||||
_("Ladin"),
|
|
||||||
3,
|
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
"mt",
|
"mt",
|
||||||
# Translators: Language name for ISO code "mt". The parenthesis clarifies
|
# Translators: Language name for ISO code "mt". The parenthesis clarifies
|
||||||
|
@ -334,15 +334,6 @@ CLDRPLURALS = (
|
||||||
3,
|
3,
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"scn",
|
|
||||||
# Translators: Language name for ISO code "scn". The parenthesis clarifies
|
|
||||||
# variant of the language. It could contain a region, age (Old, Middle, ...)
|
|
||||||
# or other variant.
|
|
||||||
_("Sicilian"),
|
|
||||||
3,
|
|
||||||
"(n == 1) ? 0 : ((n != 0 && n % 1000000 == 0) ? 1 : 2)",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
QTPLURALS = (
|
QTPLURALS = (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue