summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorbenselme <benselme@gmail.com>2015-01-09 14:56:31 -0500
committerbenselme <benselme@gmail.com>2015-01-09 14:56:31 -0500
commit9327e0824a1bbed538e73d42b971988f8214b490 (patch)
tree124cc7b279a1b0fe3c01e7939204d03b4fed2610 /scripts
parent071e38a1c9d882e3290430255a5a707d3d9aa8e0 (diff)
downloadbabel-9327e0824a1bbed538e73d42b971988f8214b490.tar.gz
Fixed import and format_timedelta to handle new time unit patterns in cldr-24.
Fixed tests to account for various minor changes in cldr-24.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/import_cldr.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
index 082393c..6378041 100755
--- a/scripts/import_cldr.py
+++ b/scripts/import_cldr.py
@@ -609,14 +609,25 @@ def main():
# <units>
unit_patterns = data.setdefault('unit_patterns', {})
- for elem in tree.findall('.//units/unit'):
- unit_type = elem.attrib['type']
- for pattern in elem.findall('unitPattern'):
- box = unit_type
- if 'alt' in pattern.attrib:
- box += ':' + pattern.attrib['alt']
- unit_patterns.setdefault(box, {})[pattern.attrib['count']] = \
- text_type(pattern.text)
+ for elem in tree.findall('.//units/unitLength'):
+ unit_length_type = elem.attrib['type']
+ for unit in elem.findall('unit'):
+ unit_type = unit.attrib['type']
+ for pattern in unit.findall('unitPattern'):
+ box = unit_type
+ box += ':' + unit_length_type
+ unit_patterns.setdefault(box, {})[pattern.attrib['count']] = \
+ text_type(pattern.text)
+
+ date_fields = data.setdefault('date_fields', {})
+ for elem in tree.findall('.//dates/fields/field'):
+ field_type = elem.attrib['type']
+ date_fields.setdefault(field_type, {})
+ for rel_time in elem.findall('relativeTime'):
+ rel_time_type = rel_time.attrib['type']
+ for pattern in rel_time.findall('relativeTimePattern'):
+ date_fields[field_type].setdefault(rel_time_type, {})\
+ [pattern.attrib['count']] = text_type(pattern.text)
outfile = open(data_filename, 'wb')
try: