Skip to content

Commit 87fc58a

Browse files
committed
feat: include list of additional decimal tags
This will make it possible to implement workaround for WeblateOrg/weblate#7520 in the translate-toolkit.
1 parent 71bd433 commit 87fc58a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

scripts/export-plural-tags.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292

9393
result = {}
9494
decimals = {}
95+
decimal_extras = {}
9596

9697
with open(BASE_FILE) as handle:
9798
data = json.load(handle)
@@ -103,6 +104,9 @@
103104
if "@integer" in rule
104105
]
105106
decimals[locale] = [name.replace("pluralRule-count-", "") for name in rules]
107+
only_decimals = set(decimals[locale]) - set(result[locale])
108+
if only_decimals:
109+
decimal_extras[locale] = list(only_decimals)
106110

107111
# Process CLDR
108112
with open(ALIASES_FILE) as handle:
@@ -148,6 +152,7 @@
148152
output.write(HEADER)
149153
output.write(f"PLURAL_TAGS = {pprint.pformat(result)}\n\n")
150154
output.write(f"DECIMAL_PLURAL_TAGS = {pprint.pformat(decimals)}\n")
155+
output.write(f"DECIMAL_EXTRA_TAGS = {pprint.pformat(decimal_extras)}\n")
151156
output.write(f"QT_PLURAL_TAGS = {pprint.pformat(qtplurals)}\n")
152157

153158
# Apply coding style

weblate_language_data/plural_tags.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,16 @@
725725
"zh": ["other"],
726726
"zu": ["one", "other"],
727727
}
728+
DECIMAL_EXTRA_TAGS = {
729+
"be": ["other"],
730+
"cs": ["many"],
731+
"gv": ["many"],
732+
"lt": ["many"],
733+
"pl": ["other"],
734+
"ru": ["other"],
735+
"sk": ["many"],
736+
"uk": ["other"],
737+
}
728738
QT_PLURAL_TAGS = {
729739
"aa": ["one", "other"],
730740
"ab": ["one", "other"],

0 commit comments

Comments
 (0)