summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@gmail.com>2007-06-04 14:28:54 +0000
committerChristopher Lenz <cmlenz@gmail.com>2007-06-04 14:28:54 +0000
commit0ff9314eb9547cfbac8c9012ff0118e81f7c4c4e (patch)
treef9780f006523dada80f8754e2571d5ae732ee8e3 /scripts
parenta3115a786004b5515e395335f759c001221ab80c (diff)
downloadbabel-0ff9314eb9547cfbac8c9012ff0118e81f7c4c4e.tar.gz
* Import datetime patterns from CLDR.
* Make the date/time arguments to the formatting functions optional, defaulting to the current date/time.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dump_data.py6
-rwxr-xr-xscripts/import_cldr.py10
2 files changed, 13 insertions, 3 deletions
diff --git a/scripts/dump_data.py b/scripts/dump_data.py
index 453f639..67c1396 100755
--- a/scripts/dump_data.py
+++ b/scripts/dump_data.py
@@ -14,7 +14,7 @@
from pprint import pprint
import sys
-from babel import Locale
-locale = Locale(sys.argv[1])
-pprint(locale._data)
+from babel.localedata import load
+
+pprint(load(sys.argv[1]))
diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
index 678d672..4a4521b 100755
--- a/scripts/import_cldr.py
+++ b/scripts/import_cldr.py
@@ -239,6 +239,16 @@ def main():
except ValueError, e:
print>>sys.stderr, 'ERROR: %s' % e
+ datetime_formats = data.setdefault('datetime_formats', {})
+ for elem in calendar.findall('dateTimeFormats/dateTimeFormatLength'):
+ if 'draft' in elem.attrib and elem.attrib.get('type') in datetime_formats:
+ continue
+ try:
+ datetime_formats[elem.attrib.get('type')] = \
+ unicode(elem.findtext('dateTimeFormat/pattern'))
+ except ValueError, e:
+ print>>sys.stderr, 'ERROR: %s' % e
+
# <numbers>
number_symbols = data.setdefault('number_symbols', {})