diff 0.9.x/scripts/import_cldr.py @ 348:05975a0e7021 stable

Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
author cmlenz
date Mon, 16 Jun 2008 12:48:43 +0000
parents 5b7d3f9f7d74
children 6a0e7205790f
line wrap: on
line diff
--- a/0.9.x/scripts/import_cldr.py
+++ b/0.9.x/scripts/import_cldr.py
@@ -55,7 +55,7 @@
 
     sup = parse(os.path.join(srcdir, 'supplemental', 'supplementalData.xml'))
 
-    # import global data from the supplemental files
+    # Import global data from the supplemental files
     global_data = {}
 
     territory_zones = global_data.setdefault('territory_zones', {})
@@ -69,6 +69,14 @@
             for alias in elem.attrib['aliases'].split():
                 zone_aliases[alias] = tzid
 
+    # Import Metazone mapping
+    meta_zones = global_data.setdefault('meta_zones', {})
+    tzsup = parse(os.path.join(srcdir, 'supplemental', 'metazoneInfo.xml'))
+    for elem in tzsup.findall('//timezone'):
+        for child in elem.findall('usesMetazone'):
+            if 'to' not in child.attrib: # FIXME: support old mappings
+                meta_zones[elem.attrib['type']] = child.attrib['mzone']
+
     outfile = open(os.path.join(destdir, 'global.dat'), 'wb')
     try:
         pickle.dump(global_data, outfile, 2)
@@ -197,9 +205,6 @@
                 info.setdefault('long', {})[child.tag] = unicode(child.text)
             for child in elem.findall('short/*'):
                 info.setdefault('short', {})[child.tag] = unicode(child.text)
-            for child in elem.findall('usesMetazone'):
-                if 'to' not in child.attrib: # FIXME: support old mappings
-                    info['use_metazone'] = child.attrib['mzone']
             time_zones[elem.attrib['type']] = info
 
         meta_zones = data.setdefault('meta_zones', {})
Copyright (C) 2012-2017 Edgewall Software