diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-03-29 10:50:24 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2011-03-29 15:18:07 (GMT) |
commit | 7590288fd6419159116f4392389cb8ca9691fb06 (patch) | |
tree | d38121cbb3bb2ea41cbdc7b1b2ae97f3875f7aec /util/local_database/cldr2qlocalexml.py | |
parent | 335fdd66947adadcdaaeb2896c42fba28d67843a (diff) | |
download | Qt-7590288fd6419159116f4392389cb8ca9691fb06.zip Qt-7590288fd6419159116f4392389cb8ca9691fb06.tar.gz Qt-7590288fd6419159116f4392389cb8ca9691fb06.tar.bz2 |
Added native language and country names (endonyms) to QLocale.
Task-number: QTBUG-17092
Reviewed-by: Zeno Albisser
Reviewed-by: Liang Qi
Diffstat (limited to 'util/local_database/cldr2qlocalexml.py')
-rwxr-xr-x | util/local_database/cldr2qlocalexml.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py index a67971b..f0f9cb1 100755 --- a/util/local_database/cldr2qlocalexml.py +++ b/util/local_database/cldr2qlocalexml.py @@ -234,6 +234,18 @@ def generateLocaleInfo(path): result['longTimeFormat'] = convert_date(findEntry(path, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[full]/timeFormat/pattern")) result['shortTimeFormat'] = convert_date(findEntry(path, "dates/calendars/calendar[gregorian]/timeFormats/timeFormatLength[short]/timeFormat/pattern")) + endonym = None + if country_code and script_code: + endonym = findEntryDef(path, "localeDisplayNames/languages/language[type=%s_%s_%s]" % (language_code, script_code, country_code)) + if not endonym and script_code: + endonym = findEntryDef(path, "localeDisplayNames/languages/language[type=%s_%s]" % (language_code, script_code)) + if not endonym and country_code: + endonym = findEntryDef(path, "localeDisplayNames/languages/language[type=%s_%s]" % (language_code, country_code)) + if not endonym: + endonym = findEntryDef(path, "localeDisplayNames/languages/language[type=%s]" % (language_code)) + result['language_endonym'] = endonym + result['country_endonym'] = findEntryDef(path, "localeDisplayNames/territories/territory[type=%s]" % (country_code)) + currency_format = get_number_in_system(path, "numbers/currencyFormats/currencyFormatLength/currencyFormat/pattern", numbering_system) currency_format = parse_number_format(currency_format, result) result['currencyFormat'] = currency_format[0] @@ -687,8 +699,10 @@ print " <localeList>" print \ " <locale>\n\ <language>C</language>\n\ + <languageEndonym></languageEndonym>\n\ <script>AnyScript</script>\n\ <country>AnyCountry</country>\n\ + <countryEndonym></countryEndonym>\n\ <decimal>46</decimal>\n\ <group>44</group>\n\ <list>59</list>\n\ @@ -740,8 +754,10 @@ for key in locale_keys: print " <locale>" print " <language>" + l['language'] + "</language>" + print " <languageEndonym>" + l['language_endonym'].encode('utf-8') + "</languageEndonym>" print " <script>" + l['script'] + "</script>" print " <country>" + l['country'] + "</country>" + print " <countryEndonym>" + l['country_endonym'].encode('utf-8') + "</countryEndonym>" print " <languagecode>" + l['language_code'] + "</languagecode>" print " <scriptcode>" + l['script_code'] + "</scriptcode>" print " <countrycode>" + l['country_code'] + "</countrycode>" |