Skip to content

Commit a6c52b3

Browse files
authored
Bump CLDR download script to 43 (#1043)
1 parent 65de3dc commit a6c52b3

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

babel/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ def interval_formats(self) -> localedata.LocaleDataDict:
930930
smallest changing component:
931931
932932
>>> Locale('fi_FI').interval_formats['MEd']['d']
933-
[u'E d. \u2013 ', u'E d.M.']
933+
[u'E d.\u2009\u2013\u2009', u'E d.M.']
934934
935935
.. seealso::
936936

scripts/download_import_cldr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import zipfile
1010
from urllib.request import urlretrieve
1111

12-
URL = 'http://unicode.org/Public/cldr/42/cldr-common-42.0.zip'
13-
FILENAME = 'cldr-common-42.0.zip'
14-
# Via https://unicode.org/Public/cldr/42/hashes/SHASUM512
15-
FILESUM = '315448fe6a9ac2d5a6a7fd1a27b38c5db30fed053654a803d50e3a8d06aa08ad153e8e57089fa094c561f41a54f37eecda0701b47a1813879902be71945aa38a'
12+
URL = 'http://unicode.org/Public/cldr/43/cldr-common-43.0.zip'
13+
FILENAME = 'cldr-common-43.0.zip'
14+
# Via https://unicode.org/Public/cldr/43/hashes/SHASUM512
15+
FILESUM = '930c64208d6f680d115bfa74a69445fb614910bb54233227b0b9ae85ddbce4db19e4ec863bf04ae9d4a11b2306aa7394e553384d7537487de8011f0e34877cef'
1616
BLKSIZE = 131072
1717

1818

scripts/import_cldr.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,22 @@ def parse_global(srcdir, sup):
301301
currency: tuple(sorted(regions)) for currency, regions in all_currencies.items()}
302302

303303
# Explicit parent locales
304-
for paternity in sup.findall('.//parentLocales/parentLocale'):
305-
parent = paternity.attrib['parent']
306-
for child in paternity.attrib['locales'].split():
307-
parent_exceptions[child] = parent
304+
# Since CLDR-43, there are multiple <parentLocales> statements, some of them with a `component="collations"` or
305+
# `component="segmentations"` attribute; these indicate that only some language aspects should be inherited.
306+
# (https://cldr.unicode.org/index/downloads/cldr-43)
307+
#
308+
# Ignore these for now, as one of them even points to a locale that doesn't have a corresponding XML file (sr_ME)
309+
# and we crash trying to load it.
310+
# There is no XPath support to test for an absent attribute, so use Python to filter
311+
for parentBlock in sup.findall('.//parentLocales'):
312+
if parentBlock.attrib.get('component'):
313+
# Consider only unqualified parent declarations
314+
continue
315+
316+
for paternity in parentBlock.findall('./parentLocale'):
317+
parent = paternity.attrib['parent']
318+
for child in paternity.attrib['locales'].split():
319+
parent_exceptions[child] = parent
308320

309321
# Currency decimal and rounding digits
310322
for fraction in sup.findall('.//currencyData/fractions/info'):

0 commit comments

Comments
 (0)