diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-03-22 13:07:07 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-24 18:32:16 +0100 |
commit | 552e162a67a1afcdc4e3e344100abaa6a69ab918 (patch) | |
tree | 1b625193069e1bb4ff74ddfcdccdf94817fbf2d1 /util | |
parent | 6ab6b0fc1c594a589d96d17b5ab7bdc237290f6e (diff) |
Update QLocale data from CLDR v1.8.1 to CLDR v1.9.1
Change-Id: Ic84bbc82b364b92605c1bba64b6ec815bff970cb
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'util')
-rwxr-xr-x | util/local_database/cldr2qlocalexml.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py index 3c45db206b..868dd02931 100755 --- a/util/local_database/cldr2qlocalexml.py +++ b/util/local_database/cldr2qlocalexml.py @@ -209,13 +209,33 @@ def generateLocaleInfo(path): try: return findEntry(path, xpath + "[numberSystem=" + numbering_system + "]") except xpathlite.Error: - pass + # in CLDR 1.9 number system was refactored for numbers (but not for currency) + # so if previous findEntry doesn't work we should try this: + try: + return findEntry(path, xpath.replace("/symbols/", "/symbols[numberSystem=" + numbering_system + "]/")) + except xpathlite.Error: + # fallback to default + pass return findEntry(path, xpath) + result['decimal'] = get_number_in_system(path, "numbers/symbols/decimal", numbering_system) result['group'] = get_number_in_system(path, "numbers/symbols/group", numbering_system) result['list'] = get_number_in_system(path, "numbers/symbols/list", numbering_system) result['percent'] = get_number_in_system(path, "numbers/symbols/percentSign", numbering_system) - result['zero'] = get_number_in_system(path, "numbers/symbols/nativeZeroDigit", numbering_system) + try: + numbering_systems = {} + for ns in findTagsInFile(cldr_dir + "/../supplemental/numberingSystems.xml", "numberingSystems"): + tmp = {} + id = "" + for data in ns[1:][0]: # ns looks like this: [u'numberingSystem', [(u'digits', u'0123456789'), (u'type', u'numeric'), (u'id', u'latn')]] + tmp[data[0]] = data[1] + if data[0] == u"id": + id = data[1] + numbering_systems[id] = tmp + result['zero'] = numbering_systems[numbering_system][u"digits"][0] + except e: + sys.stderr.write("Native zero detection problem:\n" + str(e) + "\n") + result['zero'] = get_number_in_system(path, "numbers/symbols/nativeZeroDigit", numbering_system) result['minus'] = get_number_in_system(path, "numbers/symbols/minusSign", numbering_system) result['plus'] = get_number_in_system(path, "numbers/symbols/plusSign", numbering_system) result['exp'] = get_number_in_system(path, "numbers/symbols/exponential", numbering_system).lower() |