From: Isaac Jurado Date: Mon, 17 Nov 2014 16:51:49 +0000 (+0100) Subject: Import currency fraction and rounding information X-Git-Tag: dev-2a51c9b95d06~10^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7e80a22c77371069e3d06b70520d9576e69db3d;p=thirdparty%2Fbabel.git Import currency fraction and rounding information Process and save the element of the supplemental data, which indicates how many decimal places should be displayed for each currency. --- diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py index 85132c7e..59dfeac6 100755 --- a/scripts/import_cldr.py +++ b/scripts/import_cldr.py @@ -144,6 +144,7 @@ def main(): likely_subtags = global_data.setdefault('likely_subtags', {}) territory_currencies = global_data.setdefault('territory_currencies', {}) parent_exceptions = global_data.setdefault('parent_exceptions', {}) + currency_fractions = global_data.setdefault('currency_fractions', {}) # create auxiliary zone->territory map from the windows zones (we don't set # the 'zones_territories' map directly here, because there are some zones @@ -228,6 +229,15 @@ def main(): for child in paternity.attrib['locales'].split(): parent_exceptions[child] = parent + # Currency decimal and rounding digits + for fraction in sup.findall('.//currencyData/fractions/info'): + cur_code = fraction.attrib['iso4217'] + cur_digits = int(fraction.attrib['digits']) + cur_rounding = int(fraction.attrib['rounding']) + cur_cdigits = int(fraction.attrib.get('cashDigits', cur_digits)) + cur_crounding = int(fraction.attrib.get('cashRounding', cur_rounding)) + currency_fractions[cur_code] = (cur_digits, cur_rounding, cur_cdigits, cur_crounding) + outfile = open(global_path, 'wb') try: pickle.dump(global_data, outfile, 2)