diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-11-02 07:12:10 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-10 02:11:00 (GMT) |
commit | 8a7bab8f497a777335814e3a3bdc78b10732f57a (patch) | |
tree | 274637d61dc9686d72453389c4ac30575d176a4c /util/local_database | |
parent | 8c67684ababc2a81f9cdd552eea90ab8accfc6b0 (diff) | |
download | Qt-8a7bab8f497a777335814e3a3bdc78b10732f57a.zip Qt-8a7bab8f497a777335814e3a3bdc78b10732f57a.tar.gz Qt-8a7bab8f497a777335814e3a3bdc78b10732f57a.tar.bz2 |
Update Qlocale data with CLDR 2.0.0
Change-Id: Ia5adad0b51a8db6e91ad60288eab67e506c19e47
Reviewed-by: Mehdi Fekari <mfekari@rim.com>
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'util/local_database')
-rw-r--r-- | util/local_database/enumdata.py | 23 | ||||
-rwxr-xr-x | util/local_database/qlocalexml2cpp.py | 1 | ||||
-rw-r--r-- | util/local_database/xpathlite.py | 42 |
3 files changed, 59 insertions, 7 deletions
diff --git a/util/local_database/enumdata.py b/util/local_database/enumdata.py index 5f51acb..1af862e 100644 --- a/util/local_database/enumdata.py +++ b/util/local_database/enumdata.py @@ -113,7 +113,7 @@ language_list = { 65 : [ "Kirghiz", "ky" ], 66 : [ "Korean", "ko" ], 67 : [ "Kurdish", "ku" ], - 68 : [ "Kurundi", "rn" ], + 68 : [ "Rundi", "rn" ], 69 : [ "Laothian", "lo" ], 70 : [ "Latin", "la" ], 71 : [ "Latvian", "lv" ], @@ -260,7 +260,26 @@ language_list = { 212 : [ "Central Morocco Tamazight", "tzm" ], 213 : [ "Koyraboro Senni", "ses" ], 214 : [ "Shambala", "ksb" ], - 215 : [ "Bodo", "brx" ] + 215 : [ "Bodo", "brx" ], + 216 : [ "Aghem", "agq" ], + 217 : [ "Basaa", "bas" ], + 218 : [ "Zarma", "dje" ], + 219 : [ "Duala", "dua" ], + 220 : [ "JolaFonyi", "dyo" ], + 221 : [ "Ewondo", "ewo" ], + 222 : [ "Bafia", "ksf" ], + 223 : [ "LubaKatanga", "lu" ], + 224 : [ "MakhuwaMeetto", "mgh" ], + 225 : [ "Mundang", "mua" ], + 226 : [ "Kwasio", "nmg" ], + 227 : [ "Nuer", "nus" ], + 228 : [ "Sakha", "sah" ], + 229 : [ "Sangu", "sbp" ], + 230 : [ "Congo Swahili", "swc" ], + 231 : [ "Tasawaq", "twq" ], + 232 : [ "Vai", "vai" ], + 233 : [ "Walser", "wae" ], + 234 : [ "Yangben", "yav" ] } country_list = { diff --git a/util/local_database/qlocalexml2cpp.py b/util/local_database/qlocalexml2cpp.py index edf311c..566195a 100755 --- a/util/local_database/qlocalexml2cpp.py +++ b/util/local_database/qlocalexml2cpp.py @@ -816,6 +816,7 @@ def main(): # 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") + qlocaleh_temp_file.write(" Kurundi = Rundi,\n") qlocaleh_temp_file.write(" LastLanguage = " + language + "\n") qlocaleh_temp_file.write(" };\n") diff --git a/util/local_database/xpathlite.py b/util/local_database/xpathlite.py index 1706b31..d7cd008 100644 --- a/util/local_database/xpathlite.py +++ b/util/local_database/xpathlite.py @@ -178,7 +178,11 @@ def _findEntryInFile(file, path, draft=None, attribute=None): if elt.attributes.has_key(attribute): return (elt.attributes[attribute].nodeValue, None) return (None, None) - return (elt.firstChild.nodeValue, None) + try: + return (elt.firstChild.nodeValue, None) + except: + pass + return (None, None) def findAlias(file): if not doc_cache.has_key(file): @@ -191,6 +195,36 @@ def findAlias(file): return False return alias_elt.attributes['source'].nodeValue +parent_locales = {} +def _fixedLookupChain(dirname, name): + # see http://www.unicode.org/reports/tr35/#Parent_Locales + if not parent_locales: + for ns in findTagsInFile(dirname + "/../supplemental/supplementalData.xml", "parentLocales"): + tmp = {} + parent_locale = "" + for data in ns[1:][0]: # ns looks like this: [u'parentLocale', [(u'parent', u'root'), (u'locales', u'az_Cyrl bs_Cyrl en_Dsrt ..')]] + tmp[data[0]] = data[1] + if data[0] == u"parent": + parent_locale = data[1] + parent_locales[parent_locale] = tmp[u"locales"].split(" ") + + items = name.split("_") + # split locale name into items and iterate through them from back to front + # example: az_Latn_AZ => [az_Latn_AZ, az_Latn, az] + items = list(reversed(map(lambda x: "_".join(items[:x+1]), range(len(items))))) + + for i in range(len(items)): + item = items[i] + for parent_locale in parent_locales.keys(): + for locale in parent_locales[parent_locale]: + if item == locale: + if parent_locale == u"root": + items = items[:i+1] + else: + items = items[:i+1] + parent_locale.split() + items[i+1:] + return items + return items + def _findEntry(base, path, draft=None, attribute=None): file = base if base.endswith(".xml"): @@ -199,10 +233,8 @@ def _findEntry(base, path, draft=None, attribute=None): else: file = base + ".xml" (dirname, filename) = os.path.split(base) - items = filename.split("_") - # split locale name into items and iterate through them from back to front - # example: az_Latn_AZ => [az_Latn_AZ, az_Latn, az] - items = reversed(map(lambda x: "_".join(items[:x+1]), range(len(items)))) + + items = _fixedLookupChain(dirname, filename) for item in items: file = dirname + "/" + item + ".xml" if os.path.isfile(file): |