]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Update to CLDR 1.5.1, which split out the metazone mappings into a separate supplemen...
authorChristopher Lenz <cmlenz@gmail.com>
Mon, 16 Jun 2008 12:24:04 +0000 (12:24 +0000)
committerChristopher Lenz <cmlenz@gmail.com>
Mon, 16 Jun 2008 12:24:04 +0000 (12:24 +0000)
ChangeLog
babel/dates.py
scripts/import_cldr.py

index ac80bd0e9f2a09a40151a06327a8776359c112df..db728ca73f5b81436cb91fe0c5549209446577bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,9 +3,16 @@ http://svn.edgewall.org/repos/babel/tags/0.9.3/
 (?, from branches/stable/0.9.x)
 
  * Fixed invalid message extraction methods causing an UnboundLocalError.
+ * Extraction method specification can now use a dot instead of the colon to
+   separate module and function name (ticket #105).
+ * Fixed message catalog compilation for locales with more than two plural
+   forms (ticket #95).
+ * Fixed compilation of message catalogs for locales with more than two plural
+   forms where the translations were empty (ticket #97).
  * The stripping of the comment tags in comments is optional now and
    is done for each line in a comment.
- * a JavaScript extractor was added.
+ * A JavaScript message extractor was added.
+ * Updated to CLDR 1.5.1.
 
 
 Version 0.9.2
index 28f69decf2213eda18a0fa5fd813a1ae488232cc..8bf399db4b29b70b084c25344b03be5ed13c8909 100644 (file)
@@ -267,10 +267,7 @@ def get_timezone_location(dt_or_tzinfo=None, locale=LC_TIME):
     # Get the canonical time-zone code
     zone = get_global('zone_aliases').get(zone, zone)
 
-    metainfo = {}
     info = locale.time_zones.get(zone, {})
-    if 'use_metazone' in info:
-        metainfo = locale.meta_zones.get(info['use_metazone'], {})
 
     # Otherwise, if there is only one timezone for the country, return the
     # localized country name
@@ -286,12 +283,15 @@ def get_timezone_location(dt_or_tzinfo=None, locale=LC_TIME):
     fallback_format = locale.zone_formats['fallback']
     if 'city' in info:
         city_name = info['city']
-    elif 'city' in metainfo:
-        city_name = metainfo['city']
-    elif '/' in zone:
-        city_name = zone.split('/', 1)[1].replace('_', ' ')
     else:
-        city_name = zone.replace('_', ' ')
+        metazone = get_global('meta_zones').get(zone)
+        metazone_info = locale.meta_zones.get(metazone, {})
+        if 'city' in metazone_info:
+            city_name = metainfo['city']
+        elif '/' in zone:
+            city_name = zone.split('/', 1)[1].replace('_', ' ')
+        else:
+            city_name = zone.replace('_', ' ')
 
     return region_format % (fallback_format % {
         '0': city_name,
@@ -386,7 +386,6 @@ def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False,
     # Get the canonical time-zone code
     zone = get_global('zone_aliases').get(zone, zone)
 
-    metainfo = {}
     info = locale.time_zones.get(zone, {})
     # Try explicitly translated zone names first
     if width in info:
@@ -397,15 +396,16 @@ def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False,
         if field in info[width]:
             return info[width][field]
 
-    if 'use_metazone' in info:
-        metainfo = locale.meta_zones.get(info['use_metazone'], {})
-        if width in metainfo and (uncommon or metainfo.get('common')):
+    metazone = get_global('meta_zones').get(zone)
+    if metazone:
+        metazone_info = locale.meta_zones.get(metazone, {})
+        if width in metazone_info and (uncommon or metazone_info.get('common')):
             if dt is None:
                 field = 'generic'
             else:
                 field = tzinfo.dst(dt) and 'daylight' or 'standard'
-            if field in metainfo[width]:
-                return metainfo[width][field]
+            if field in metazone_info[width]:
+                return metazone_info[width][field]
 
     # If we have a concrete datetime, we assume that the result can't be
     # independent of daylight savings time, so we return the GMT offset
index 26d58e0e434b15fd57d76bd1d7e809d63f8f5f2a..9f8f7c82fc53153ab1e6e9c9da7be72ad1840a66 100755 (executable)
@@ -55,7 +55,7 @@ def main():
 
     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 @@ def main():
             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 @@ def main():
                 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', {})