From: Aarni Koskela Date: Sun, 20 Dec 2015 19:29:21 +0000 (+0200) Subject: Update to CLDR 28 (with test updates) X-Git-Tag: 2.2.0~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f7f4d02998955719a8d18bfcbec8f700bec9923;p=thirdparty%2Fbabel.git Update to CLDR 28 (with test updates) * Aside from the usual data changes, the provisional aa locale is no longer, so we can't use it for tests. Instead, ii is used (chosen by virtue of ii.xml being fairly small, i.e. probably as incomplete as aa). * ms_Latn_SG is not in use anymore either; use sr_Latn_ME instead. Closes #226 Closes #290 --- diff --git a/babel/core.py b/babel/core.py index 84ee1892..06070d51 100644 --- a/babel/core.py +++ b/babel/core.py @@ -113,10 +113,10 @@ class Locale(object): If a locale is requested for which no locale data is available, an `UnknownLocaleError` is raised: - >>> Locale.parse('en_DE') + >>> Locale.parse('en_XX') Traceback (most recent call last): ... - UnknownLocaleError: unknown locale 'en_DE' + UnknownLocaleError: unknown locale 'en_XX' For more information see :rfc:`3066`. """ @@ -432,8 +432,8 @@ class Locale(object): script_name = property(get_script_name, doc="""\ The localized script name of the locale if available. - >>> Locale('ms', 'SG', script='Latn').script_name - u'Latin' + >>> Locale('sr', 'ME', script='Latn').script_name + u'latinica' """) @property diff --git a/babel/dates.py b/babel/dates.py index 0b735388..ab2d4fb2 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -582,7 +582,7 @@ def format_datetime(datetime=None, format='medium', tzinfo=None, >>> format_datetime(dt, 'full', tzinfo=get_timezone('Europe/Paris'), ... locale='fr_FR') - u'dimanche 1 avril 2007 17:30:00 heure d\u2019\xe9t\xe9 d\u2019Europe centrale' + u'dimanche 1 avril 2007 \xe0 17:30:00 heure d\u2019\xe9t\xe9 d\u2019Europe centrale' >>> format_datetime(dt, "yyyy.MM.dd G 'at' HH:mm:ss zzz", ... tzinfo=get_timezone('US/Eastern'), locale='en') u'2007.04.01 AD at 11:30:00 EDT' @@ -742,7 +742,7 @@ def format_timedelta(delta, granularity='second', threshold=.85, The format parameter controls how compact or wide the presentation is: >>> format_timedelta(timedelta(hours=3), format='short', locale='en') - u'3 hrs' + u'3 hr' >>> format_timedelta(timedelta(hours=3), format='narrow', locale='en') u'3h' diff --git a/babel/numbers.py b/babel/numbers.py index f0b0ca1b..e4b3e8ee 100644 --- a/babel/numbers.py +++ b/babel/numbers.py @@ -265,7 +265,7 @@ def format_currency(number, currency, format=None, locale=LC_NUMERIC, >>> format_currency(1099.98, 'USD', locale='en_US') u'$1,099.98' >>> format_currency(1099.98, 'USD', locale='es_CO') - u'US$1.099,98' + u'US$\\xa01.099,98' >>> format_currency(1099.98, 'EUR', locale='de_DE') u'1.099,98\\xa0\\u20ac' diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index f9523aac..4da34234 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -5,7 +5,6 @@ import sys import shutil import hashlib import zipfile -import urllib import subprocess try: from urllib.request import urlretrieve @@ -13,9 +12,9 @@ except ImportError: from urllib import urlretrieve -URL = 'http://unicode.org/Public/cldr/26/core.zip' -FILENAME = 'core-26.zip' -FILESUM = '46220170238b092685fd24221f895e3d' +URL = 'http://unicode.org/Public/cldr/28/core.zip' +FILENAME = 'core-28.zip' +FILESUM = 'bc545b4c831e1987ea931b04094d7b9fc59ec3d8' BLKSIZE = 131072 @@ -53,7 +52,7 @@ def is_good_file(filename): if not os.path.isfile(filename): log('Local copy \'%s\' not found', filename) return False - h = hashlib.md5() + h = hashlib.sha1() with open(filename, 'rb') as f: while 1: blk = f.read(BLKSIZE) diff --git a/tests/messages/test_plurals.py b/tests/messages/test_plurals.py index 8c11745f..d54857f7 100644 --- a/tests/messages/test_plurals.py +++ b/tests/messages/test_plurals.py @@ -34,7 +34,7 @@ def test_get_plural_accpets_strings(): def test_get_plural_falls_back_to_default(): - assert plurals.get_plural('aa') == (2, '(n != 1)') + assert plurals.get_plural('ii') == (2, '(n != 1)') def test_plural_tuple_attributes(): diff --git a/tests/test_dates.py b/tests/test_dates.py index 0f099f31..ea4805bb 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -282,14 +282,14 @@ class FormatTimedeltaTestCase(unittest.TestCase): self.assertEqual('0 seconds', string) string = dates.format_timedelta(timedelta(seconds=0), locale='en', format='short') - self.assertEqual('0 secs', string) + self.assertEqual('0 sec', string) string = dates.format_timedelta(timedelta(seconds=0), granularity='hour', locale='en') self.assertEqual('0 hours', string) string = dates.format_timedelta(timedelta(seconds=0), granularity='hour', locale='en', format='short') - self.assertEqual('0 hrs', string) + self.assertEqual('0 hr', string) def test_small_value_with_granularity(self): string = dates.format_timedelta(timedelta(seconds=42), @@ -465,7 +465,7 @@ def test_format_datetime(): full = dates.format_datetime(dt, 'full', tzinfo=timezone('Europe/Paris'), locale='fr_FR') - assert full == (u'dimanche 1 avril 2007 17:30:00 heure ' + assert full == (u'dimanche 1 avril 2007 à 17:30:00 heure ' u'd\u2019\xe9t\xe9 d\u2019Europe centrale') custom = dates.format_datetime(dt, "yyyy.MM.dd G 'at' HH:mm:ss zzz", tzinfo=timezone('US/Eastern'), locale='en') diff --git a/tests/test_numbers.py b/tests/test_numbers.py index f042833b..4b8a48dc 100644 --- a/tests/test_numbers.py +++ b/tests/test_numbers.py @@ -230,7 +230,7 @@ def test_format_currency(): assert (numbers.format_currency(1099.98, 'USD', locale='en_US') == u'$1,099.98') assert (numbers.format_currency(1099.98, 'USD', locale='es_CO') - == u'US$1.099,98') + == u'US$\xa01.099,98') assert (numbers.format_currency(1099.98, 'EUR', locale='de_DE') == u'1.099,98\xa0\u20ac') assert (numbers.format_currency(1099.98, 'EUR', u'\xa4\xa4 #,##0.00', diff --git a/tests/test_plural.py b/tests/test_plural.py index b0cad8da..fce1b8e0 100644 --- a/tests/test_plural.py +++ b/tests/test_plural.py @@ -133,10 +133,10 @@ def test_plural_within_rules(): def test_locales_with_no_plural_rules_have_default(): from babel import Locale - aa_plural = Locale.parse('aa').plural_form - assert aa_plural(1) == 'other' - assert aa_plural(2) == 'other' - assert aa_plural(15) == 'other' + pf = Locale.parse('ii').plural_form + assert pf(1) == 'other' + assert pf(2) == 'other' + assert pf(15) == 'other' WELL_FORMED_TOKEN_TESTS = (