(?, 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
# 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
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,
# 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:
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
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', {})
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)
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', {})