]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Bump CLDR download script to 43 (#1043)
authorRico Hermans <rix0rrr@gmail.com>
Sat, 18 Nov 2023 15:15:46 +0000 (16:15 +0100)
committerGitHub <noreply@github.com>
Sat, 18 Nov 2023 15:15:46 +0000 (17:15 +0200)
babel/core.py
scripts/download_import_cldr.py
scripts/import_cldr.py

index f63b97b65d26021849a0ed3b902dbc058e0875d0..ef0d16a1d6326b2a563f14934ca5eae926564c30 100644 (file)
@@ -930,7 +930,7 @@ class Locale:
         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::
 
index c08c7fc08d01b4fcff226ec0e6f26f8d500f1120..bcee0ea7cfd0fe5a76a5eceafafc3ab1eb9b227d 100755 (executable)
@@ -9,10 +9,10 @@ import sys
 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
 
 
index 4937874072dd9ccb0642fad1319b51e2120f4c08..96b6c9438d92d6e074118a6165c396a918d97ef1 100755 (executable)
@@ -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'):