diff scripts/import_cldr.py @ 11:11f64b232b04

Add basic support for number format patterns.
author jonas
date Wed, 30 May 2007 21:30:14 +0000
parents 0ca5dd65594f
children b47c34d42eda
line wrap: on
line diff
--- a/scripts/import_cldr.py
+++ b/scripts/import_cldr.py
@@ -22,7 +22,7 @@
 except ImportError:
     from elementtree.ElementTree import parse
 
-from babel.dates import parse_pattern
+from babel import dates, numbers
 
 weekdays = {'mon': 1, 'tue': 2, 'wed': 3, 'thu': 4, 'fri': 5, 'sat': 6,
             'sun': 7}
@@ -225,7 +225,7 @@
                     continue
                 try:
                     date_formats[elem.attrib.get('type')] = \
-                        parse_pattern(unicode(elem.findtext('dateFormat/pattern')))
+                        dates.parse_pattern(unicode(elem.findtext('dateFormat/pattern')))
                 except ValueError, e:
                     print e
 
@@ -235,7 +235,7 @@
                     continue
                 try:
                     time_formats[elem.attrib.get('type')] = \
-                        parse_pattern(unicode(elem.findtext('timeFormat/pattern')))
+                        dates.parse_pattern(unicode(elem.findtext('timeFormat/pattern')))
                 except ValueError, e:
                     print e
 
@@ -249,7 +249,7 @@
         for elem in tree.findall('//decimalFormats/decimalFormatLength'):
             if 'draft' in elem.attrib and elem.attrib.get('type') in decimal_formats:
                 continue
-            decimal_formats[elem.attrib.get('type')] = unicode(elem.findtext('decimalFormat/pattern'))
+            decimal_formats[elem.attrib.get('type')] = numbers.parse_pattern(unicode(elem.findtext('decimalFormat/pattern')))
 
         scientific_formats = data.setdefault('scientific_formats', {})
         for elem in tree.findall('//scientificFormats/scientificFormatLength'):
Copyright (C) 2012-2017 Edgewall Software