Skip to content

Commit

Permalink
Bump CLDR download script to 43 (python-babel#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr authored Nov 18, 2023
1 parent 65de3dc commit a6c52b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion babel/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ def interval_formats(self) -> localedata.LocaleDataDict:
smallest changing component:
>>> Locale('fi_FI').interval_formats['MEd']['d']
[u'E d. \u2013 ', u'E d.M.']
[u'E d.\u2009\u2013\u2009', u'E d.M.']
.. seealso::
Expand Down
8 changes: 4 additions & 4 deletions scripts/download_import_cldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import zipfile
from urllib.request import urlretrieve

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


Expand Down
20 changes: 16 additions & 4 deletions scripts/import_cldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,22 @@ def parse_global(srcdir, sup):
currency: tuple(sorted(regions)) for currency, regions in all_currencies.items()}

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

for paternity in parentBlock.findall('./parentLocale'):
parent = paternity.attrib['parent']
for child in paternity.attrib['locales'].split():
parent_exceptions[child] = parent

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

0 comments on commit a6c52b3

Please sign in to comment.