Skip to content

Commit

Permalink
fix: remove duplicate plural definitions for Qt
Browse files Browse the repository at this point in the history
The source file contains ambiguous definition for Filipino and double
definition for Interlingua.
  • Loading branch information
nijel committed Oct 15, 2024
1 parent 9707e58 commit 5994f50
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
2 changes: 0 additions & 2 deletions qt.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ et,Estonian,2,(n != 1)
eu,Basque,2,(n != 1)
fa,Persian,1,0
fi,Finnish,2,(n != 1)
fil,Filipino,2,(n > 1)
fil,Filipino,3,(n==1 ? 0 : (n%10==4 || n%10==6 || n%10== 9) ? 1 : 2)
fj,Fijian,1,0
fo,Faroese,2,(n != 1)
Expand All @@ -51,7 +50,6 @@ hr,Croatian,3,(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%1
hu,Hungarian,1,0
hy,Armenian,2,(n > 1)
ia,Interlingua,2,(n != 1)
ia,Interlingua,2,(n != 1)
id,Indonesian,1,0
ik,Inupiaq,3,(n==1 ? 0 : n==2 ? 1 : 2)
is,Icelandic,2,(n%10==1 && n%100!=11 ? 0 : 1)
Expand Down
9 changes: 8 additions & 1 deletion scripts/export-qt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import csv
ALIASES = {
"Chinese": ("Chinese (Simplified Han script)", "Chinese (Traditional Han script)"),
"WesternFrisian": ("Frisian",),
"Interlingue": ("Interlingua",),
"Interlingue": (), # Ignore, duplicate for Interlingua
"Khmer": ("Khmer (Central)",),
"Kirghiz": ("Kyrgyz",),
"NorthernSotho": ("Pedi",),
Expand Down Expand Up @@ -56,6 +56,9 @@ PLURALS = {}
def handle_language(parts):
text = "".join(parts).replace("\n", "")[31:]
name = text.split("[", 1)[0]
# Remove duplicate definition
if name == "frenchStyleLanguages":
text = text.replace("QLocale::Filipino,", "")
# Hack to deal with frenchStyleCountries
if name == "frenchStyleLanguages":
text = text.replace("Portuguese", "PortugueseBrasil")
Expand Down Expand Up @@ -103,11 +106,14 @@ with open("modules/qttools/src/linguist/shared/numerus.cpp") as handle:
in_table = True

output = []
processed = set()


def generate(group, name):
definition = DEFINITIONS[name]
plural = PLURALS[group]
if definition[0] in processed:
raise ValueError(f"Duplicate definition for {definition[0]}")
output.append(
(
definition[0],
Expand All @@ -116,6 +122,7 @@ def generate(group, name):
plural[1],
)
)
processed.add(definition[0])


for group, languages in LANGUAGES.items():
Expand Down
1 change: 1 addition & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def parse_csv(name):
languages = parse_csv("languages.csv")
aliases = parse_csv("aliases.csv")
cldr = parse_csv("cldr.csv")
parse_csv("qt.csv")
default_countries = parse_csv("default_countries.csv")

for alias in aliases:
Expand Down
18 changes: 0 additions & 18 deletions weblate_language_data/plurals.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,6 @@
2,
"(n != 1)",
),
(
"fil",
# Translators: Language name for ISO code "fil". The parenthesis clarifies
# variant of the language. It could contain a region, age (Old, Middle, ...)
# or other variant.
_("Filipino"),
2,
"(n > 1)",
),
(
"fil",
# Translators: Language name for ISO code "fil". The parenthesis clarifies
Expand Down Expand Up @@ -796,15 +787,6 @@
2,
"(n != 1)",
),
(
"ia",
# Translators: Language name for ISO code "ia". The parenthesis clarifies
# variant of the language. It could contain a region, age (Old, Middle, ...)
# or other variant.
_("Interlingua"),
2,
"(n != 1)",
),
(
"id",
# Translators: Language name for ISO code "id". The parenthesis clarifies
Expand Down

0 comments on commit 5994f50

Please sign in to comment.