From 54413653d5fb12bb08b9cbf1554b732bc0b8d1fb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 19 Feb 2020 14:08:22 +0100 Subject: Rename the endonym members of the Locale type All other members had camelCase names, but the endonyms had prefix_endonym names, requiring munging where they were emitted to XML. So just do that munging upstream in the attribute name of the Locale objects. Makes no change to the data output by the scripts, not even to the intermediate QLocaleXML file. Task-number: QTBUG-81344 Change-Id: I01c15a822216281dc669b3e7ebda096d18b04f9b Reviewed-by: Lars Knoll Reviewed-by: Cristian Maureira-Fredes --- util/locale_database/cldr2qlocalexml.py | 4 ++-- util/locale_database/localexml.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'util') diff --git a/util/locale_database/cldr2qlocalexml.py b/util/locale_database/cldr2qlocalexml.py index a1df872e01..6a0b6cbe1a 100755 --- a/util/locale_database/cldr2qlocalexml.py +++ b/util/locale_database/cldr2qlocalexml.py @@ -340,8 +340,8 @@ def _generateLocaleInfo(path, language_code, script_code, country_code, variant_ 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)) + result['languageEndonym'] = endonym + result['countryEndonym'] = 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) diff --git a/util/locale_database/localexml.py b/util/locale_database/localexml.py index 9b353f5122..187227886f 100644 --- a/util/locale_database/localexml.py +++ b/util/locale_database/localexml.py @@ -190,7 +190,7 @@ class Locale: ('minus', '-'), ('plus', '+'), ('exp', 'e')): print inner + "<%s>" % key + fixOrdStr(get(key), std) + "" % key - for key in ('language_endonym', 'country_endonym', + for key in ('languageEndonym', 'countryEndonym', 'quotationStart', 'quotationEnd', 'alternateQuotationStart', 'alternateQuotationEnd', 'listPatternPartStart', 'listPatternPartMiddle', @@ -208,8 +208,7 @@ class Locale: '_'.join((k, cal)) for k in self.propsMonthDay('months') for cal in calendars): - ent = camelCase(key.split('_')) if key.endswith('_endonym') else key - print inner + "<%s>%s" % (ent, escape(get(key)).encode('utf-8'), ent) + print inner + "<%s>%s" % (key, escape(get(key)).encode('utf-8'), key) for key in ('currencyDigits', 'currencyRounding'): print inner + "<%s>%d" % (key, get(key), key) @@ -283,9 +282,9 @@ class Locale: quantifiers=('k', 'M', 'G', 'T', 'P', 'E')): """Returns an object representing the C locale.""" return cls(dict(cls.__monthNames(calendars)), - language='C', language_code='0', language_endonym='', + language='C', language_code='0', languageEndonym='', script='AnyScript', script_code='0', - country='AnyCountry', country_code='0', country_endonym='', + country='AnyCountry', country_code='0', countryEndonym='', decimal='.', group=',', list=';', percent='%', zero='0', minus='-', plus='+', exp='e', quotationStart='"', quotationEnd='"', -- cgit v1.2.3