Mercurial > babel > old > mirror
diff babel/dates.py @ 347:c22f292731be
Update to CLDR 1.5.1, which split out the metazone mappings into a separate supplemental file.
author | cmlenz |
---|---|
date | Mon, 16 Jun 2008 12:24:04 +0000 |
parents | 36c243367cc9 |
children | e5db561bf70e |
line wrap: on
line diff
--- a/babel/dates.py +++ b/babel/dates.py @@ -267,10 +267,7 @@ # 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 @@ 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 @@ # 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 @@ 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