summaryrefslogtreecommitdiffstats
path: root/util/local_database/enumdata.py
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-08-13 14:32:18 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-08-16 10:10:04 +0000
commitcd0a76a1503668155f67d7243e6e9aa8c4d77377 (patch)
treef944ef47442d78b853065431b66f0bb1f08ef9c0 /util/local_database/enumdata.py
parentd363113745edab3a52da009837f0f940409234aa (diff)
Tidy up generation of aliases in locale-related enums
Replace lines of formatted output with dictionaries from which that output can be generated efficiently (in sorted order). Tidy up the python code, in the process. Change-Id: Ifb74eb69342646c5dbabc3247b3a8ddef602e934 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'util/local_database/enumdata.py')
-rw-r--r--util/local_database/enumdata.py49
1 files changed, 46 insertions, 3 deletions
diff --git a/util/local_database/enumdata.py b/util/local_database/enumdata.py
index 5505b68575b..e24ac02b076 100644
--- a/util/local_database/enumdata.py
+++ b/util/local_database/enumdata.py
@@ -27,9 +27,13 @@
##
#############################################################################
-# language_list and country_list reflect the current values of enums in qlocale.h
-# If new xml language files are available in CLDR, these languages and countries
-# need to be *appended* to this list (for compatibility between versions).
+# Each *_list reflects the current values of its enums in qlocale.h;
+# if new xml language files are available in CLDR, these languages and
+# countries need to be *appended* to this list (for compatibility
+# between versions). Include any spaces present in names (scripts
+# shall squish them out for the enum entries) in *_list, but use the
+# squished forms of names in the *_aliases mappings.
+
### Qt 6: restore alphabetic order in each list.
language_list = {
@@ -395,6 +399,25 @@ language_list = {
359 : ["Tangut", "txg"]
}
+language_aliases = {
+ # Legacy - should disappear at some point:
+ 'Norwegian': 'NorwegianBokmal',
+ 'Moldavian': 'Romanian',
+ 'SerboCroatian': 'Serbian',
+ 'Tagalog': 'Filipino',
+ 'Twi': 'Akan',
+ # Renamings:
+ 'Afan': 'Oromo',
+ 'Byelorussian': 'Belarusian',
+ 'Bhutani': 'Dzongkha',
+ 'Cambodian': 'Khmer',
+ 'Kurundi': 'Rundi',
+ 'RhaetoRomance': 'Romansh',
+ 'Chewa': 'Nyanja',
+ 'Frisian': 'WesternFrisian',
+ 'Uigur': 'Uighur',
+}
+
country_list = {
0 : ["AnyCountry", "ZZ"],
1 : ["Afghanistan", "AF"],
@@ -660,6 +683,20 @@ country_list = {
261 : ["Europe", "150"]
}
+country_aliases = {
+ # Deprecated:
+ 'Tokelau': 'TokelauCountry',
+ 'Tuvalu': 'TuvaluCountry',
+ # Renamings:
+ 'DemocraticRepublicOfCongo': 'CongoKinshasa',
+ 'PeoplesRepublicOfCongo': 'CongoBrazzaville',
+ 'DemocraticRepublicOfKorea': 'NorthKorea',
+ 'RepublicOfKorea': 'SouthKorea',
+ 'RussianFederation': 'Russia',
+ 'SyrianArabRepublic': 'Syria',
+ 'LatinAmericaAndTheCaribbean': 'LatinAmerica',
+}
+
script_list = {
0 : ["AnyScript", "Zzzz"],
1 : ["Arabic", "Arab"],
@@ -805,6 +842,12 @@ script_list = {
141 : ["Jamo", "Jamo"]
}
+script_aliases = {
+ # Renamings:
+ 'SimplifiedChineseScript': 'SimplifiedHanScript',
+ 'TraditionalChineseScript': 'TraditionalHanScript',
+}
+
def countryCodeToId(code):
if not code:
return 0