language-data/extract-plural-tags
Michal Čihař 9812558e7d Apply black code formatter
Signed-off-by: Michal Čihař <michal@cihar.com>
2019-04-17 10:56:26 +02:00

20 lines
526 B
Python
Executable file

#! /usr/bin/env python3
#
# Copyright © 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
from xml.etree import ElementTree
import pprint
result = {}
tree = ElementTree.parse("cldr-core/common/supplemental/plurals.xml")
for item in tree.iter("pluralRules"):
locales = item.get("locales").split()
rules = [x.get("count") for x in item.iter("pluralRule") if "@integer" in x.text]
for locale in locales:
result[locale] = rules
print(pprint.pformat(result))