From e7c79face6ec361e4ad0ff8303f1becafac8b2b6 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 21 Nov 2012 15:45:18 +0200 Subject: [SIC/BIC] QLocale: update enums up to CLRD 1.9.1 This patch adds some missing codes (two-letter ones only), removes an outdated ones, and updates some names. The legacy language codes are handled in QLocalePrivate::codeToLanguage() (fortunately, there are only 4 of such codes). Change-Id: Iff50aecd1c762b6399cd151aebb955f341d366c6 Reviewed-by: Lars Knoll --- util/local_database/cldr2qlocalexml.py | 7 +- util/local_database/enumdata.py | 158 +++++++++++++++++++-------------- util/local_database/qlocalexml2cpp.py | 24 ++++- 3 files changed, 117 insertions(+), 72 deletions(-) (limited to 'util/local_database') diff --git a/util/local_database/cldr2qlocalexml.py b/util/local_database/cldr2qlocalexml.py index b5c4a79d3c..893b662f25 100755 --- a/util/local_database/cldr2qlocalexml.py +++ b/util/local_database/cldr2qlocalexml.py @@ -124,10 +124,6 @@ def generateLocaleInfo(path): script_code = findEntryInFile(path, "identity/script", attribute="type")[0] variant_code = findEntryInFile(path, "identity/variant", attribute="type")[0] - # we should handle fully qualified names with the territory - if not country_code: - return {} - # we do not support variants # ### actually there is only one locale with variant: en_US_POSIX # does anybody care about it at all? @@ -146,6 +142,9 @@ def generateLocaleInfo(path): return {} script = enumdata.script_list[script_id][0] + # we should handle fully qualified names with the territory + if not country_code: + return {} country_id = enumdata.countryCodeToId(country_code) if country_id <= 0: sys.stderr.write("unknown country code \"" + country_code + "\"\n") diff --git a/util/local_database/enumdata.py b/util/local_database/enumdata.py index 1c92aec944..06fcb58be5 100644 --- a/util/local_database/enumdata.py +++ b/util/local_database/enumdata.py @@ -48,29 +48,29 @@ language_list = { 0 : [ "AnyLanguage", " " ], 1 : [ "C", " " ], 2 : [ "Abkhazian", "ab" ], - 3 : [ "Afan", "om" ], + 3 : [ "Oromo", "om" ], # macrolanguage 4 : [ "Afar", "aa" ], 5 : [ "Afrikaans", "af" ], - 6 : [ "Albanian", "sq" ], + 6 : [ "Albanian", "sq" ], # macrolanguage 7 : [ "Amharic", "am" ], - 8 : [ "Arabic", "ar" ], + 8 : [ "Arabic", "ar" ], # macrolanguage 9 : [ "Armenian", "hy" ], 10 : [ "Assamese", "as" ], - 11 : [ "Aymara", "ay" ], - 12 : [ "Azerbaijani", "az" ], + 11 : [ "Aymara", "ay" ], # macrolanguage + 12 : [ "Azerbaijani", "az" ], # macrolanguage 13 : [ "Bashkir", "ba" ], 14 : [ "Basque", "eu" ], 15 : [ "Bengali", "bn" ], - 16 : [ "Bhutani", "dz" ], + 16 : [ "Dzongkha", "dz" ], 17 : [ "Bihari", "bh" ], 18 : [ "Bislama", "bi" ], 19 : [ "Breton", "br" ], 20 : [ "Bulgarian", "bg" ], 21 : [ "Burmese", "my" ], - 22 : [ "Byelorussian", "be" ], - 23 : [ "Cambodian", "km" ], + 22 : [ "Belarusian", "be" ], + 23 : [ "Khmer", "km" ], 24 : [ "Catalan", "ca" ], - 25 : [ "Chinese", "zh" ], + 25 : [ "Chinese", "zh" ], # macrolanguage 26 : [ "Corsican", "co" ], 27 : [ "Croatian", "hr" ], 28 : [ "Czech", "cs" ], @@ -78,9 +78,9 @@ language_list = { 30 : [ "Dutch", "nl" ], 31 : [ "English", "en" ], 32 : [ "Esperanto", "eo" ], - 33 : [ "Estonian", "et" ], + 33 : [ "Estonian", "et" ], # macrolanguage 34 : [ "Faroese", "fo" ], - 35 : [ "Fiji", "fj" ], + 35 : [ "Fijian", "fj" ], 36 : [ "Finnish", "fi" ], 37 : [ "French", "fr" ], 38 : [ "Frisian", "fy" ], @@ -90,7 +90,7 @@ language_list = { 42 : [ "German", "de" ], 43 : [ "Greek", "el" ], 44 : [ "Greenlandic", "kl" ], - 45 : [ "Guarani", "gn" ], + 45 : [ "Guarani", "gn" ], # macrolanguage 46 : [ "Gujarati", "gu" ], 47 : [ "Hausa", "ha" ], 48 : [ "Hebrew", "he" ], @@ -100,8 +100,8 @@ language_list = { 52 : [ "Indonesian", "id" ], 53 : [ "Interlingua", "ia" ], 54 : [ "Interlingue", "ie" ], - 55 : [ "Inuktitut", "iu" ], - 56 : [ "Inupiak", "ik" ], + 55 : [ "Inuktitut", "iu" ], # macrolanguage + 56 : [ "Inupiak", "ik" ], # macrolanguage 57 : [ "Irish", "ga" ], 58 : [ "Italian", "it" ], 59 : [ "Japanese", "ja" ], @@ -112,41 +112,41 @@ language_list = { 64 : [ "Kinyarwanda", "rw" ], 65 : [ "Kirghiz", "ky" ], 66 : [ "Korean", "ko" ], - 67 : [ "Kurdish", "ku" ], - 68 : [ "Kurundi", "rn" ], - 69 : [ "Laothian", "lo" ], + 67 : [ "Kurdish", "ku" ], # macrolanguage + 68 : [ "Rundi", "rn" ], + 69 : [ "Lao", "lo" ], 70 : [ "Latin", "la" ], - 71 : [ "Latvian", "lv" ], + 71 : [ "Latvian", "lv" ], # macrolanguage 72 : [ "Lingala", "ln" ], 73 : [ "Lithuanian", "lt" ], 74 : [ "Macedonian", "mk" ], - 75 : [ "Malagasy", "mg" ], - 76 : [ "Malay", "ms" ], + 75 : [ "Malagasy", "mg" ], # macrolanguage + 76 : [ "Malay", "ms" ], # macrolanguage 77 : [ "Malayalam", "ml" ], 78 : [ "Maltese", "mt" ], 79 : [ "Maori", "mi" ], 80 : [ "Marathi", "mr" ], - 81 : [ "Moldavian", "mo" ], # deprecated (alias to "ro_MD") - 82 : [ "Mongolian", "mn" ], - 83 : [ "Nauru", "na" ], - 84 : [ "Nepali", "ne" ], - 85 : [ "Norwegian", "nb" ], + 81 : [ "Marshallese", "mh" ], + 82 : [ "Mongolian", "mn" ], # macrolanguage + 83 : [ "Nauru", "na" ], + 84 : [ "Nepali", "ne" ], # macrolanguage + 85 : [ "NorwegianBokmal", "nb" ], 86 : [ "Occitan", "oc" ], - 87 : [ "Oriya", "or" ], - 88 : [ "Pashto", "ps" ], - 89 : [ "Persian", "fa" ], + 87 : [ "Oriya", "or" ], # macrolanguage + 88 : [ "Pashto", "ps" ], # macrolanguage + 89 : [ "Persian", "fa" ], # macrolanguage 90 : [ "Polish", "pl" ], 91 : [ "Portuguese", "pt" ], 92 : [ "Punjabi", "pa" ], - 93 : [ "Quechua", "qu" ], - 94 : [ "RhaetoRomance", "rm" ], + 93 : [ "Quechua", "qu" ], # macrolanguage + 94 : [ "Romansh", "rm" ], 95 : [ "Romanian", "ro" ], 96 : [ "Russian", "ru" ], 97 : [ "Samoan", "sm" ], 98 : [ "Sangho", "sg" ], 99 : [ "Sanskrit", "sa" ], 100 : [ "Serbian", "sr" ], - 101 : [ "SerboCroatian", "sh" ], # legacy (alias to "sr_Latn") + 101 : [ "Ossetic", "os" ], 102 : [ "Sesotho", "st" ], 103 : [ "Setswana", "tn" ], 104 : [ "Shona", "sn" ], @@ -158,9 +158,9 @@ language_list = { 110 : [ "Somali", "so" ], 111 : [ "Spanish", "es" ], 112 : [ "Sundanese", "su" ], - 113 : [ "Swahili", "sw" ], + 113 : [ "Swahili", "sw" ], # macrolanguage 114 : [ "Swedish", "sv" ], - 115 : [ "Tagalog", "tl" ], # legacy (alias to "fil") + 115 : [ "Sardinian", "sc" ], # macrolanguage 116 : [ "Tajik", "tg" ], 117 : [ "Tamil", "ta" ], 118 : [ "Tatar", "tt" ], @@ -168,30 +168,30 @@ language_list = { 120 : [ "Thai", "th" ], 121 : [ "Tibetan", "bo" ], 122 : [ "Tigrinya", "ti" ], - 123 : [ "Tonga", "to" ], + 123 : [ "Tonga", "to" ], 124 : [ "Tsonga", "ts" ], 125 : [ "Turkish", "tr" ], 126 : [ "Turkmen", "tk" ], - 127 : [ "Twi", "tw" ], # should be an alias to Akan + 127 : [ "Tahitian", "ty" ], 128 : [ "Uigur", "ug" ], 129 : [ "Ukrainian", "uk" ], 130 : [ "Urdu", "ur" ], - 131 : [ "Uzbek", "uz" ], + 131 : [ "Uzbek", "uz" ], # macrolanguage 132 : [ "Vietnamese", "vi" ], 133 : [ "Volapuk", "vo" ], 134 : [ "Welsh", "cy" ], 135 : [ "Wolof", "wo" ], 136 : [ "Xhosa", "xh" ], - 137 : [ "Yiddish", "yi" ], + 137 : [ "Yiddish", "yi" ], # macrolanguage 138 : [ "Yoruba", "yo" ], - 139 : [ "Zhuang", "za" ], + 139 : [ "Zhuang", "za" ], # macrolanguage 140 : [ "Zulu", "zu" ], - 141 : [ "Nynorsk", "nn" ], + 141 : [ "NorwegianNynorsk", "nn" ], 142 : [ "Bosnian", "bs" ], 143 : [ "Divehi", "dv" ], 144 : [ "Manx", "gv" ], 145 : [ "Cornish", "kw" ], - 146 : [ "Akan", "ak" ], + 146 : [ "Akan", "ak" ], # macrolanguage 147 : [ "Konkani", "kok" ], 148 : [ "Ga", "gaa" ], 149 : [ "Igbo", "ig" ], @@ -222,7 +222,7 @@ language_list = { 174 : [ "Taroko", "trv" ], 175 : [ "Gusii", "guz" ], 176 : [ "Taita", "dav" ], - 177 : [ "Fulah", "ff" ], + 177 : [ "Fulah", "ff" ], # macrolanguage 178 : [ "Kikuyu", "ki" ], 179 : [ "Samburu", "saq" ], 180 : [ "Sena", "seh" ], @@ -260,7 +260,28 @@ language_list = { 212 : [ "Central Morocco Tamazight", "tzm" ], 213 : [ "Koyraboro Senni", "ses" ], 214 : [ "Shambala", "ksb" ], - 215 : [ "Bodo", "brx" ] + 215 : [ "Bodo", "brx" ], + 216 : [ "Avaric", "av" ], + 217 : [ "Chamorro", "ch" ], + 218 : [ "Chechen", "ce" ], + 219 : [ "Church", "cu" ], # macrolanguage + 220 : [ "Chuvash", "cv" ], + 221 : [ "Cree", "cr" ], # macrolanguage + 222 : [ "Haitian", "ht" ], + 223 : [ "Herero", "hz" ], + 224 : [ "Hiri Motu", "ho" ], + 225 : [ "Kanuri", "kr" ], # macrolanguage + 226 : [ "Komi", "kv" ], # macrolanguage + 227 : [ "Kongo", "kg" ], # macrolanguage + 228 : [ "Kwanyama", "kj" ], + 229 : [ "Limburgish", "li" ], + 230 : [ "LubaKatanga", "lu" ], + 231 : [ "Luxembourgish", "lb" ], + 232 : [ "Navaho", "nv" ], + 233 : [ "Ndonga", "ng" ], + 234 : [ "Ojibwa", "oj" ], # macrolanguage + 235 : [ "Pali", "pi" ], # macrolanguage + 236 : [ "Walloon", "wa" ] } country_list = { @@ -296,7 +317,7 @@ country_list = { 29 : [ "BouvetIsland", "BV" ], 30 : [ "Brazil", "BR" ], 31 : [ "BritishIndianOceanTerritory", "IO" ], - 32 : [ "BruneiDarussalam", "BN" ], + 32 : [ "Brunei", "BN" ], 33 : [ "Bulgaria", "BG" ], 34 : [ "BurkinaFaso", "BF" ], 35 : [ "Burundi", "BI" ], @@ -313,8 +334,8 @@ country_list = { 46 : [ "CocosIslands", "CC" ], 47 : [ "Colombia", "CO" ], 48 : [ "Comoros", "KM" ], - 49 : [ "DemocraticRepublicOfCongo", "CD" ], - 50 : [ "PeoplesRepublicOfCongo", "CG" ], + 49 : [ "CongoKinshasa", "CD" ], + 50 : [ "CongoBrazzaville", "CG" ], 51 : [ "CookIslands", "CK" ], 52 : [ "CostaRica", "CR" ], 53 : [ "IvoryCoast", "CI" ], @@ -336,10 +357,10 @@ country_list = { 69 : [ "Ethiopia", "ET" ], 70 : [ "FalklandIslands", "FK" ], 71 : [ "FaroeIslands", "FO" ], - 72 : [ "Fiji", "FJ" ], + 72 : [ "Fiji", "FJ" ], 73 : [ "Finland", "FI" ], 74 : [ "France", "FR" ], - 75 : [ "MetropolitanFrance", "FX" ], + 75 : [ "Guernsey", "GG" ], 76 : [ "FrenchGuiana", "GF" ], 77 : [ "FrenchPolynesia", "PF" ], 78 : [ "FrenchSouthernTerritories", "TF" ], @@ -377,16 +398,16 @@ country_list = { 110 : [ "Kazakhstan", "KZ" ], 111 : [ "Kenya", "KE" ], 112 : [ "Kiribati", "KI" ], - 113 : [ "DemocraticRepublicOfKorea", "KP" ], - 114 : [ "RepublicOfKorea", "KR" ], + 113 : [ "NorthKorea", "KP" ], + 114 : [ "SouthKorea", "KR" ], 115 : [ "Kuwait", "KW" ], 116 : [ "Kyrgyzstan", "KG" ], - 117 : [ "Lao", "LA" ], + 117 : [ "Laos", "LA" ], 118 : [ "Latvia", "LV" ], 119 : [ "Lebanon", "LB" ], 120 : [ "Lesotho", "LS" ], 121 : [ "Liberia", "LR" ], - 122 : [ "LibyanArabJamahiriya", "LY" ], + 122 : [ "Libya", "LY" ], 123 : [ "Liechtenstein", "LI" ], 124 : [ "Lithuania", "LT" ], 125 : [ "Luxembourg", "LU" ], @@ -413,7 +434,7 @@ country_list = { 146 : [ "Mozambique", "MZ" ], 147 : [ "Myanmar", "MM" ], 148 : [ "Namibia", "NA" ], - 149 : [ "Nauru", "NR" ], + 149 : [ "Nauru", "NR" ], 150 : [ "Nepal", "NP" ], 151 : [ "Netherlands", "NL" ], 152 : [ "NetherlandsAntilles", "AN" ], @@ -429,7 +450,7 @@ country_list = { 162 : [ "Oman", "OM" ], 163 : [ "Pakistan", "PK" ], 164 : [ "Palau", "PW" ], - 165 : [ "PalestinianTerritory", "PS" ], + 165 : [ "PalestinianTerritories", "PS" ], 166 : [ "Panama", "PA" ], 167 : [ "PapuaNewGuinea", "PG" ], 168 : [ "Paraguay", "PY" ], @@ -442,11 +463,11 @@ country_list = { 175 : [ "Qatar", "QA" ], 176 : [ "Reunion", "RE" ], 177 : [ "Romania", "RO" ], - 178 : [ "RussianFederation", "RU" ], + 178 : [ "Russia", "RU" ], 179 : [ "Rwanda", "RW" ], 180 : [ "SaintKittsAndNevis", "KN" ], - 181 : [ "StLucia", "LC" ], - 182 : [ "StVincentAndTheGrenadines", "VC" ], + 181 : [ "SaintLucia", "LC" ], + 182 : [ "SaintVincentAndTheGrenadines", "VC" ], 183 : [ "Samoa", "WS" ], 184 : [ "SanMarino", "SM" ], 185 : [ "SaoTomeAndPrincipe", "ST" ], @@ -463,22 +484,22 @@ country_list = { 196 : [ "SouthGeorgiaAndTheSouthSandwichIslands", "GS" ], 197 : [ "Spain", "ES" ], 198 : [ "SriLanka", "LK" ], - 199 : [ "StHelena", "SH" ], - 200 : [ "StPierreAndMiquelon", "PM" ], + 199 : [ "SaintHelena", "SH" ], + 200 : [ "SaintPierreAndMiquelon", "PM" ], 201 : [ "Sudan", "SD" ], 202 : [ "Suriname", "SR" ], 203 : [ "SvalbardAndJanMayenIslands", "SJ" ], 204 : [ "Swaziland", "SZ" ], 205 : [ "Sweden", "SE" ], 206 : [ "Switzerland", "CH" ], - 207 : [ "SyrianArabRepublic", "SY" ], + 207 : [ "Syria", "SY" ], 208 : [ "Taiwan", "TW" ], 209 : [ "Tajikistan", "TJ" ], 210 : [ "Tanzania", "TZ" ], 211 : [ "Thailand", "TH" ], 212 : [ "Togo", "TG" ], 213 : [ "Tokelau", "TK" ], - 214 : [ "Tonga", "TO" ], + 214 : [ "Tonga", "TO" ], 215 : [ "TrinidadAndTobago", "TT" ], 216 : [ "Tunisia", "TN" ], 217 : [ "Turkey", "TR" ], @@ -496,21 +517,28 @@ country_list = { 229 : [ "Vanuatu", "VU" ], 230 : [ "VaticanCityState", "VA" ], 231 : [ "Venezuela", "VE" ], - 232 : [ "VietNam", "VN" ], + 232 : [ "Vietnam", "VN" ], 233 : [ "BritishVirginIslands", "VG" ], - 234 : [ "USVirginIslands", "VI" ], + 234 : [ "UnitedStatesVirginIslands", "VI" ], 235 : [ "WallisAndFutunaIslands", "WF" ], 236 : [ "WesternSahara", "EH" ], 237 : [ "Yemen", "YE" ], - 238 : [ "Yugoslavia", "YU" ], + 238 : [ "CanaryIslands", "IC" ], 239 : [ "Zambia", "ZM" ], 240 : [ "Zimbabwe", "ZW" ], - 241 : [ "SerbiaAndMontenegro", "CS" ], + 241 : [ "ClippertonIsland", "CP" ], 242 : [ "Montenegro", "ME" ], 243 : [ "Serbia", "RS" ], 244 : [ "Saint Barthelemy", "BL" ], 245 : [ "Saint Martin", "MF" ], - 246 : [ "LatinAmericaAndTheCaribbean", "419" ] + 246 : [ "LatinAmericaAndTheCaribbean", "419" ], + 247 : [ "AscensionIsland", "AC" ], + 248 : [ "AlandIslands", "AX" ], + 249 : [ "DiegoGarcia", "DG" ], + 250 : [ "CeutaAndMelilla", "EA" ], + 251 : [ "IsleOfMan", "IM" ], + 252 : [ "Jersey", "JE" ], + 253 : [ "TristanDaCunha", "TA" ] } script_list = { diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py index b225d4fba5..b82e1516b4 100755 --- a/util/local_database/qlocalexml2cpp.py +++ b/util/local_database/qlocalexml2cpp.py @@ -803,9 +803,19 @@ def main(): for key in language_map.keys(): language = fixedLanguageName(language_map[key][0], dupes) qlocaleh_temp_file.write(" " + language + " = " + str(key) + ",\n") - # special cases for norwegian. we really need to make it right at some point. - qlocaleh_temp_file.write(" NorwegianBokmal = Norwegian,\n") - qlocaleh_temp_file.write(" NorwegianNynorsk = Nynorsk,\n") + # legacy. should disappear at some point + qlocaleh_temp_file.write(" Norwegian = NorwegianBokmal,\n") + qlocaleh_temp_file.write(" Moldavian = Romanian,\n") + qlocaleh_temp_file.write(" SerboCroatian = Serbian,\n") + qlocaleh_temp_file.write(" Tagalog = Filipino,\n") + qlocaleh_temp_file.write(" Twi = Akan,\n") + # renamings + qlocaleh_temp_file.write(" Afan = Oromo,\n") + qlocaleh_temp_file.write(" Byelorussian = Belarusian,\n") + qlocaleh_temp_file.write(" Bhutani = Dzongkha,\n") + qlocaleh_temp_file.write(" Cambodian = Khmer,\n") + qlocaleh_temp_file.write(" Kurundi = Rundi,\n") + qlocaleh_temp_file.write(" RhaetoRomance = Romansh,\n") qlocaleh_temp_file.write(" LastLanguage = " + language + "\n") qlocaleh_temp_file.write(" };\n") @@ -817,6 +827,7 @@ def main(): for key in script_map.keys(): script = fixedScriptName(script_map[key][0], dupes) qlocaleh_temp_file.write(" " + script + " = " + str(key) + ",\n") + # renamings qlocaleh_temp_file.write(" SimplifiedChineseScript = SimplifiedHanScript,\n") qlocaleh_temp_file.write(" TraditionalChineseScript = TraditionalHanScript,\n") qlocaleh_temp_file.write(" LastScript = " + script + "\n") @@ -828,6 +839,13 @@ def main(): for key in country_map.keys(): country = fixedCountryName(country_map[key][0], dupes) qlocaleh_temp_file.write(" " + country + " = " + str(key) + ",\n") + # renamings + qlocaleh_temp_file.write(" DemocraticRepublicOfCongo = CongoKinshasa,\n") + qlocaleh_temp_file.write(" PeoplesRepublicOfCongo = CongoBrazzaville,\n") + qlocaleh_temp_file.write(" DemocraticRepublicOfKorea = NorthKorea,\n") + qlocaleh_temp_file.write(" RepublicOfKorea = SouthKorea,\n") + qlocaleh_temp_file.write(" RussianFederation = Russia,\n") + qlocaleh_temp_file.write(" SyrianArabRepublic = Syria,\n") qlocaleh_temp_file.write(" LastCountry = " + country + "\n") qlocaleh_temp_file.write(" };\n") -- cgit v1.2.3