From cff985f7c231ae6e407d84fb076efcc09c3c775a Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 10:22:53 +0100 Subject: [PATCH 01/15] Add new date pattern --- babel/dates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel/dates.py b/babel/dates.py index 7f3371248..39e5f5641 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -1755,7 +1755,7 @@ def get_week_number(self, day_of_period: int, day_of_week: int | None = None) -> 'Q': [1, 2, 3, 4, 5], 'q': [1, 2, 3, 4, 5], # quarter 'M': [1, 2, 3, 4, 5], 'L': [1, 2, 3, 4, 5], # month 'w': [1, 2], 'W': [1], # week - 'd': [1, 2], 'D': [1, 2, 3], 'F': [1], 'g': None, # day + 'd': [1, 2, 3], 'D': [1, 2, 3], 'F': [1], 'g': None, # day 'E': [1, 2, 3, 4, 5, 6], 'e': [1, 2, 3, 4, 5, 6], 'c': [1, 3, 4, 5, 6], # week day 'a': [1, 2, 3, 4, 5], 'b': [1, 2, 3, 4, 5], 'B': [1, 2, 3, 4, 5], # period 'h': [1, 2], 'H': [1, 2], 'K': [1, 2], 'k': [1, 2], # hour From 98cb2eb51e2339062c5968731db89fb27338b8da Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 10:43:48 +0100 Subject: [PATCH 02/15] Update test_get_cldr_version --- tests/test_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_core.py b/tests/test_core.py index 445ed67a8..856c5a7b8 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -188,4 +188,4 @@ def test_locale_parse_empty(): def test_get_cldr_version(): - assert core.get_cldr_version() == "48" + assert core.get_cldr_version() == "49" From 62fb9737d4a57b24e475c92824684f2cb66a2122 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 10:44:23 +0100 Subject: [PATCH 03/15] Update download script to fetch exemplars --- scripts/download_import_cldr.py | 40 +++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 082b2efec..8d118ed00 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -9,10 +9,13 @@ import zipfile from urllib.request import Request, urlopen -URL = 'https://unicode.org/Public/cldr/48.2/cldr-common-48.2.zip' -FILENAME = 'cldr-common-48.2.zip' -# Via https://unicode.org/Public/cldr/48.2/hashes/SHASUM512.txt (core.zip; see https://unicode-org.atlassian.net/browse/CLDR-19388) -FILESUM = 'de8660f5371e0fcfd03a42e3b4fc4c686ec6cd602b402f1e3d227844005a54eb7952873894443523837d5828c42874a1a267a19f91ded207a2d166144791fa62' +COMMON_URL = 'https://unicode.org/Public/cldr/49/cldr-common-49.zip' +COMMON_FILENAME = 'cldr-common-49.zip' +EXEMPLARS_URL = 'https://unicode.org/Public/cldr/49/cldr-exemplars-delta-49.zip' +EXEMPLARS_FILENAME = 'cldr-exemplars-delta-49.zip' +# Via https://unicode.org/Public/cldr/49/hashes/SHASUM512.txt (core.zip; see https://unicode-org.atlassian.net/browse/CLDR-19388) +COMMON_FILESUM = 'c704a2baf9ce4e28f40e242f8b2fbd0123579bb2c56daaaf8a92d72abd02485a1f60095c3cc4fe89eaf2d5c9f5fd07954c2eaee88839f97e18b1ff37cd62e2d8' +EXEMPLARS_FILESUM = '8c0331f4927833499d24a716e2d072a87ae169098d41886d3ae51028e4f5033f8c139339c2c8b073b59da8431663c91ed15d24a61aaa78305994e22326521836' def reporthook(bytes_transmitted, total_size): @@ -46,7 +49,7 @@ def download_file(url, dest_path, reporthook=None): reporthook(out_file.tell(), total_size) -def is_good_file(filename): +def is_good_file(filename, filesum): if not os.path.isfile(filename): log(f"Local copy '{filename}' not found") return False @@ -58,8 +61,8 @@ def is_good_file(filename): break h.update(blk) digest = h.hexdigest() - if digest != FILESUM: - raise RuntimeError(f'Checksum mismatch: {digest!r} != {FILESUM!r}') + if digest != filesum: + raise RuntimeError(f'Checksum mismatch: {digest!r} != {filesum!r}') else: return True @@ -68,15 +71,22 @@ def main(): scripts_path = os.path.dirname(os.path.abspath(__file__)) repo = os.path.dirname(scripts_path) cldr_dl_path = os.path.join(repo, 'cldr') - cldr_path = os.path.join(repo, 'cldr', os.path.splitext(FILENAME)[0]) - zip_path = os.path.join(cldr_dl_path, FILENAME) + cldr_path = os.path.join(repo, 'cldr', os.path.splitext(COMMON_FILENAME)[0]) + common_zip_path = os.path.join(cldr_dl_path, COMMON_FILENAME) + exemplars_zip_path = os.path.join(cldr_dl_path, EXEMPLARS_FILENAME) changed = False show_progress = (False if os.environ.get("BABEL_CLDR_NO_DOWNLOAD_PROGRESS") else sys.stdout.isatty()) - while not is_good_file(zip_path): - tmp_path = f"{zip_path}.tmp" - download_file(URL, tmp_path, (reporthook if show_progress else None)) - os.replace(tmp_path, zip_path) + while not is_good_file(common_zip_path, COMMON_FILESUM): + tmp_path = f"{common_zip_path}.tmp" + download_file(COMMON_URL, tmp_path, (reporthook if show_progress else None)) + os.replace(tmp_path, common_zip_path) + changed = True + print() + while not is_good_file(exemplars_zip_path, EXEMPLARS_FILESUM): + tmp_path = f"{exemplars_zip_path}.tmp" + download_file(EXEMPLARS_URL, tmp_path, (reporthook if show_progress else None)) + os.replace(tmp_path, exemplars_zip_path) changed = True print() common_path = os.path.join(cldr_path, 'common') @@ -87,7 +97,9 @@ def main(): shutil.rmtree(common_path) log(f"Extracting CLDR to '{cldr_path}'") - with contextlib.closing(zipfile.ZipFile(zip_path)) as z: + with contextlib.closing(zipfile.ZipFile(common_zip_path)) as z: + z.extractall(cldr_path) + with contextlib.closing(zipfile.ZipFile(exemplars_zip_path)) as z: z.extractall(cldr_path) subprocess.check_call([ From 9b711accdd0f797abc8d5994ff789ad7f21125f3 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 13:33:47 +0100 Subject: [PATCH 04/15] Fix get_cldr_version doctest --- babel/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel/core.py b/babel/core.py index 1acdbd628..79f644868 100644 --- a/babel/core.py +++ b/babel/core.py @@ -1397,7 +1397,7 @@ def get_cldr_version() -> str: function is a string representing a version number, e.g. '47'. >>> get_cldr_version() - '48' + '49' .. versionadded:: 2.18 From 928256c7b06c89bdc766082773f5e661ee489546 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 13:36:12 +0100 Subject: [PATCH 05/15] Fix test_list_currencies --- tests/test_numbers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_numbers.py b/tests/test_numbers.py index d20a18315..0e146566f 100644 --- a/tests/test_numbers.py +++ b/tests/test_numbers.py @@ -40,7 +40,7 @@ def test_list_currencies(): assert list_currencies(locale='pa_Arab') == {'PKR', 'INR', 'EUR'} - assert len(list_currencies()) == 308 + assert len(list_currencies()) == 307 def test_validate_currency(): From 8d084d5a1f00dac76aee43697c2c9b14b49200f2 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 13:36:31 +0100 Subject: [PATCH 06/15] Fix format_currency doctest --- babel/numbers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/babel/numbers.py b/babel/numbers.py index 09e7a767f..83424ec19 100644 --- a/babel/numbers.py +++ b/babel/numbers.py @@ -787,8 +787,8 @@ def format_currency( '1.00 US dollar' >>> format_currency(1099.98, 'USD', locale='en_US', format_type='name') '1,099.98 US dollars' - >>> format_currency(1099.98, 'USD', locale='ee', format_type='name') - 'us ga dollar 1,099.98' + >>> format_currency(1099.98, 'USD', locale='my', format_type='name') + 'အမေရိကန် ဒေါ်လာ 1,099.98' By default the locale is allowed to truncate and round a high-precision number by forcing its format pattern onto the decimal part. You can bypass From 8c944ae605de1725da9e8b497d4042467511c661 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 13:39:40 +0100 Subject: [PATCH 07/15] Fix test_format_currency_long_display_name --- tests/test_numbers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_numbers.py b/tests/test_numbers.py index 0e146566f..dec80a9f5 100644 --- a/tests/test_numbers.py +++ b/tests/test_numbers.py @@ -382,8 +382,8 @@ def test_format_currency_long_display_name(): assert (numbers.format_currency(2, 'EUR', locale='en_US', format_type='name') == '2.00 euros') # This tests that '{1} {0}' unitPatterns are found: - assert (numbers.format_currency(150, 'USD', locale='sw', format_type='name') - == 'dola za Marekani 150.00') + assert (numbers.format_currency(150, 'USD', locale='my', format_type='name') + == 'အမေရိကန် ဒေါ်လာ 150.00') assert (numbers.format_currency(1, 'USD', locale='sw', format_type='name') == '1.00 dola ya Marekani') # This tests unicode chars: From 0f84b676cce3650ea51047cac233a3e96259b82d Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 13:39:57 +0100 Subject: [PATCH 08/15] Fix test_get_currency_unit_pattern --- tests/test_numbers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_numbers.py b/tests/test_numbers.py index dec80a9f5..5098b1adf 100644 --- a/tests/test_numbers.py +++ b/tests/test_numbers.py @@ -90,7 +90,7 @@ def test_get_currency_precision(): def test_get_currency_unit_pattern(): assert get_currency_unit_pattern('USD', locale='en_US') == '{0} {1}' - assert get_currency_unit_pattern('USD', locale='sw') == '{1} {0}' + assert get_currency_unit_pattern('USD', locale='my') == '{1} {0}' # 'ro' locale various pattern according to count assert get_currency_unit_pattern('USD', locale='ro', count=1) == '{0} {1}' From d765632488c96a43aa4a84378bbc246e9a27c032 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 14:11:50 +0100 Subject: [PATCH 09/15] Fix datetime_skeletons doctest --- babel/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel/core.py b/babel/core.py index 79f644868..dc6f3cfc0 100644 --- a/babel/core.py +++ b/babel/core.py @@ -1009,7 +1009,7 @@ def datetime_skeletons(self) -> localedata.LocaleDataDict: >>> Locale('fr').datetime_skeletons['MEd'] >>> Locale('fr').datetime_skeletons['H'] - + """ return self._data['datetime_skeletons'] From b34feac57c1d4836a64300318e9e31db061fbed0 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 15:24:27 +0100 Subject: [PATCH 10/15] Fix zone and metazone parsing metazones can now contain aliases, which the parser currently cannot handle. This updates the import script to return an `Alias` instance for aliased metazones. --- babel/core.py | 4 ++-- scripts/import_cldr.py | 49 ++++++++++++++++++++++++-------------- tests/test_dates.py | 10 ++++++++ tests/test_locale_class.py | 2 +- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/babel/core.py b/babel/core.py index dc6f3cfc0..39fb0a909 100644 --- a/babel/core.py +++ b/babel/core.py @@ -877,8 +877,8 @@ def time_zones(self) -> localedata.LocaleDataDict: .. note:: The format of the value returned may change between Babel versions. - >>> Locale('en', 'US').time_zones['Europe/London']['long']['daylight'] - 'British Summer Time' + >>> Locale('en', 'US').time_zones['Etc/UTC']['long']['standard'] + 'Coordinated Universal Time' >>> Locale('en', 'US').time_zones['America/St_Johns']['city'] 'St. John’s' >>> Locale('de').time_zones['Asia/Kolkata']['city'] diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py index ab7f8e8f3..5c344af34 100755 --- a/scripts/import_cldr.py +++ b/scripts/import_cldr.py @@ -616,27 +616,40 @@ def parse_dates(data, tree, sup, regions, territory, zone_aliases): break time_zones = data.setdefault('time_zones', {}) for elem in tree.findall('.//timeZoneNames/zone'): - info = {} - city = elem.findtext('exemplarCity') - if city: - info['city'] = str(city) - for child in elem.findall('long/*'): - info.setdefault('long', {})[child.tag] = str(child.text) - for child in elem.findall('short/*'): - info.setdefault('short', {})[child.tag] = str(child.text) tzid = elem.attrib['type'] - time_zones[zone_aliases.get(tzid, tzid)] = info + tzid = zone_aliases.get(tzid, tzid) + time_zones[tzid] = _parse_zone_names(elem, ['time_zones', tzid]) meta_zones = data.setdefault('meta_zones', {}) for elem in tree.findall('.//timeZoneNames/metazone'): - info = {} - city = elem.findtext('exemplarCity') - if city: - info['city'] = str(city) - for child in elem.findall('long/*'): - info.setdefault('long', {})[child.tag] = str(child.text) - for child in elem.findall('short/*'): - info.setdefault('short', {})[child.tag] = str(child.text) - meta_zones[elem.attrib['type']] = info + mzid = elem.attrib['type'] + meta_zones[mzid] = _parse_zone_names(elem, ['meta_zones', mzid]) + + +def _parse_zone_names(elem, ctxt): + """ + Parse the names of a ```` or ```` element. + + Since CLDR 49, ``root.xml`` aliases ```` names of one metazone to + those of another (specifically ``British`` and ``Irish`` fall back to ``GMT``). + """ + info = {} + city = elem.findtext('exemplarCity') + if city: + info['city'] = str(city) + for width in ('long', 'short'): + width_elem = elem.find(width) + if width_elem is None: + continue + names = {} + for child in width_elem: + if child.tag == 'alias': + info[width] = Alias(_translate_alias([*ctxt, width], child.attrib['path'])) + break + names[child.tag] = str(child.text) + else: + if names: + info[width] = names + return info def parse_calendar_months(data, calendar): diff --git a/tests/test_dates.py b/tests/test_dates.py index ee7285e27..ea53613ae 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -355,6 +355,16 @@ def test_get_timezone_location(timezone_getter): ("America/Indiana/Indianapolis", {"locale": "en_US"}, "Eastern Time"), ("Europe/Kyiv", {"locale": "en"}, "Eastern European Time"), ("Europe/Kiev", {"locale": "en"}, "Eastern European Time"), + # Since CLDR 49, the `British` and `Irish` metazones alias the long names + # they don't define themselves to the `GMT` metazone (in root.xml) + ("Europe/London", {"locale": "en", "zone_variant": "generic"}, "British Time"), + ("Europe/London", {"locale": "en", "zone_variant": "standard"}, "Greenwich Mean Time"), + ("Europe/London", {"locale": "en", "zone_variant": "daylight"}, "British Summer Time"), + ("Europe/London", {"locale": "en_GB", "width": "short", "zone_variant": "standard"}, "GMT"), + ("Europe/London", {"locale": "en_GB", "width": "short", "zone_variant": "daylight"}, "BST"), + ("Europe/London", {"locale": "de", "zone_variant": "standard"}, "Mittlere Greenwich-Zeit"), + ("Europe/Dublin", {"locale": "en", "zone_variant": "standard"}, "Greenwich Mean Time"), + ("Europe/Dublin", {"locale": "en", "zone_variant": "daylight"}, "Irish Standard Time"), ], ) def test_get_timezone_name_tzinfo(timezone_getter, tzname, params, expected): diff --git a/tests/test_locale_class.py b/tests/test_locale_class.py index 5ddb3e876..a4061332b 100644 --- a/tests/test_locale_class.py +++ b/tests/test_locale_class.py @@ -173,7 +173,7 @@ def test_eras_property(): def test_time_zones_property(): time_zones = Locale('en', 'US').time_zones - assert time_zones['Europe/London']['long']['daylight'] == 'British Summer Time' + assert time_zones['Etc/UTC']['long']['standard'] == 'Coordinated Universal Time' assert time_zones['America/St_Johns']['city'] == 'St. John\u2019s' From 2bb76dc5b1e88de63445120a3e223d76f5e63764 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 15:27:19 +0100 Subject: [PATCH 11/15] Filter out exemplars and keep only below-Basic locales --- scripts/download_import_cldr.py | 251 +++++++++++++++++++++++++++++++- tests/test_localedata.py | 4 + 2 files changed, 254 insertions(+), 1 deletion(-) diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 8d118ed00..836cc7cf4 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -17,6 +17,251 @@ COMMON_FILESUM = 'c704a2baf9ce4e28f40e242f8b2fbd0123579bb2c56daaaf8a92d72abd02485a1f60095c3cc4fe89eaf2d5c9f5fd07954c2eaee88839f97e18b1ff37cd62e2d8' EXEMPLARS_FILESUM = '8c0331f4927833499d24a716e2d072a87ae169098d41886d3ae51028e4f5033f8c139339c2c8b073b59da8431663c91ed15d24a61aaa78305994e22326521836' +# In CLDR 49, the common zip no longer contains the locales below Basic +# coverage. See: https://cldr.unicode.org/downloads/cldr-49#migration. The +# stated plan is to remove all locales below Basic coverage in CLDR 50. Since +# presumably some locales will achieve Basic coverage in CLDR 50, we should keep +# all the existing below-Basic coverage locales as is until CLDR 50 makes it +# official. +# +# The below-Basic locales have been moved to a separate file +# ("cldr-exemplars-delta-49.zip"). This file however contains also ~1500 files +# from the CLDR repository's `exemplars/` directory. These are locales that +# don't have data in CLDR and were never available in Babel. We only want to +# merge below-Basic locales with the common data while keeping the exemplars out. +# To do so, we generate an explicit list of all the below-Basic locales. +# +# To regnerate the list, run: +# +# git clone --depth 1 --branch release-49 --filter=blob:none --no-checkout https://github.com/unicode-org/cldr +# comm -13 <(unzip -Z1 cldr-common-49.zip 'common/main/*.xml' | sort) \ +# <(git -C cldr ls-tree --name-only release-49 common/main/ | grep '\.xml$' | sort) \ +# | sed 's|common/main/||; s|\.xml$||' +# +BELOW_BASIC_LOCALES = frozenset( + [ + 'aa', + 'aa_DJ', + 'aa_ER', + 'aa_ET', + 'ab', + 'ab_GE', + 'an', + 'an_ES', + 'ann', + 'ann_NG', + 'apc', + 'apc_SY', + 'arn', + 'arn_CL', + 'ary', + 'ary_MA', + 'az_Arab', + 'az_Arab_IQ', + 'az_Arab_IR', + 'az_Arab_TR', + 'bal', + 'bal_Arab', + 'bal_Arab_PK', + 'bew', + 'bew_ID', + 'bgn', + 'bgn_AE', + 'bgn_AF', + 'bgn_IR', + 'bgn_OM', + 'bgn_PK', + 'blt', + 'blt_VN', + 'bm_Nkoo', + 'bm_Nkoo_ML', + 'bqi', + 'bqi_IR', + 'brh', + 'brh_PK', + 'bss', + 'bss_CM', + 'byn', + 'byn_ER', + 'cad', + 'cad_US', + 'cch', + 'cch_NG', + 'cho', + 'cho_US', + 'cic', + 'cic_US', + 'co', + 'co_FR', + 'cu', + 'cu_RU', + 'dv', + 'dv_MV', + 'en_Dsrt', + 'en_Dsrt_US', + 'en_Shaw', + 'en_Shaw_GB', + 'frr', + 'frr_DE', + 'gez', + 'gez_ER', + 'gez_ET', + 'gn', + 'gn_PY', + 'ha_Arab', + 'ha_Arab_NG', + 'ha_Arab_SD', + 'hnj', + 'hnj_Hmnp', + 'hnj_Hmnp_US', + 'hrx', + 'hrx_BR', + 'ht', + 'ht_HT', + 'io', + 'io_001', + 'isv', + 'isv_Cyrl', + 'isv_Cyrl_001', + 'isv_Latn', + 'isv_Latn_001', + 'iu', + 'iu_CA', + 'iu_Latn', + 'iu_Latn_CA', + 'jbo', + 'jbo_001', + 'kaa', + 'kaa_Cyrl', + 'kaa_Cyrl_UZ', + 'kaa_Latn', + 'kaa_Latn_UZ', + 'kaj', + 'kaj_NG', + 'kcg', + 'kcg_NG', + 'ken', + 'ken_CM', + 'kpe', + 'kpe_GN', + 'kpe_LR', + 'ku_Arab', + 'ku_Arab_IQ', + 'ku_Arab_IR', + 'la', + 'la_VA', + 'ltg', + 'ltg_LV', + 'lzz', + 'lzz_TR', + 'mdf', + 'mdf_RU', + 'mhn', + 'mhn_IT', + 'mic', + 'mic_CA', + 'mn_Mong', + 'mn_Mong_CN', + 'mn_Mong_MN', + 'mni_Mtei', + 'mni_Mtei_IN', + 'moh', + 'moh_CA', + 'mrh', + 'mrh_IN', + 'mrh_MM', + 'ms_Arab', + 'ms_Arab_BN', + 'ms_Arab_MY', + 'mus', + 'mus_US', + 'mww', + 'mww_Hmnp', + 'mww_Hmnp_US', + 'myv', + 'myv_RU', + 'nr', + 'nr_ZA', + 'nv', + 'nv_US', + 'ny', + 'ny_MW', + 'oka', + 'oka_CA', + 'oka_US', + 'osa', + 'osa_US', + 'pap', + 'pap_AW', + 'pap_CW', + 'pi', + 'pi_Latn', + 'pi_Latn_GB', + 'pis', + 'pis_SB', + 'rhg', + 'rhg_Rohg', + 'rhg_Rohg_BD', + 'rhg_Rohg_MM', + 'rif', + 'rif_MA', + 'sat_Deva', + 'sat_Deva_IN', + 'sdh', + 'sdh_IQ', + 'sdh_IR', + 'sgs', + 'sgs_LT', + 'sid', + 'sid_ET', + 'skr', + 'skr_PK', + 'sma', + 'sma_NO', + 'sma_SE', + 'smj', + 'smj_NO', + 'smj_SE', + 'sms', + 'sms_FI', + 'ss', + 'ss_SZ', + 'ss_ZA', + 'ssy', + 'ssy_ER', + 'sus', + 'sus_GN', + 'sus_SL', + 'suz', + 'suz_Deva', + 'suz_Deva_NP', + 'tig', + 'tig_ER', + 'tpi', + 'tpi_PG', + 'trv', + 'trv_TW', + 'trw', + 'trw_PK', + 'ts', + 'ts_ZA', + 've', + 've_ZA', + 'vo', + 'vo_001', + 'wa', + 'wa_BE', + 'wal', + 'wal_ET', + 'wbp', + 'wbp_AU', + 'xdq', + 'xdq_RU', + 'zh_Latn', + 'zh_Latn_CN', + ], +) + def reporthook(bytes_transmitted, total_size): cols = shutil.get_terminal_size().columns @@ -100,7 +345,11 @@ def main(): with contextlib.closing(zipfile.ZipFile(common_zip_path)) as z: z.extractall(cldr_path) with contextlib.closing(zipfile.ZipFile(exemplars_zip_path)) as z: - z.extractall(cldr_path) + wanted = {f'common/main/{locale}.xml' for locale in BELOW_BASIC_LOCALES} + members = wanted & set(z.namelist()) + for missing in sorted(wanted - members): + log(f"Warning: '{missing}' not found in '{EXEMPLARS_FILENAME}'") + z.extractall(cldr_path, members=sorted(members)) subprocess.check_call([ sys.executable, diff --git a/tests/test_localedata.py b/tests/test_localedata.py index c9046da03..9cfb253f9 100644 --- a/tests/test_localedata.py +++ b/tests/test_localedata.py @@ -184,6 +184,10 @@ def test_locale_identification(): assert localedata.exists(locale) +def test_locale_count(): + assert len(localedata.locale_identifiers()) == 1147 + + def test_unique_ids(): # Check all locale IDs are uniques. all_ids = localedata.locale_identifiers() From 2f18f0896a1ac53f3b02f25b106d5b5ef4d6d536 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 15:42:30 +0100 Subject: [PATCH 12/15] Fix pytest deprecation warning --- tests/messages/test_toml_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/messages/test_toml_config.py b/tests/messages/test_toml_config.py index 1dd37a7ac..682728490 100644 --- a/tests/messages/test_toml_config.py +++ b/tests/messages/test_toml_config.py @@ -71,7 +71,7 @@ def test_toml_mapping_add_comments_parsing(add_comments_val, expected): assert options_map['**.py'].get('add_comments') == expected -@pytest.mark.parametrize("test_case", toml_test_cases_path.glob("bad.*.toml"), ids=lambda p: p.name) +@pytest.mark.parametrize("test_case", tuple(toml_test_cases_path.glob("bad.*.toml")), ids=lambda p: p.name) def test_bad_toml_test_case(test_case: pathlib.Path): """ Test that bad TOML files raise a ValueError. From 51392e8301b6a3fc83ff2e796b27ee2c54930d51 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Tue, 3 Nov 2026 21:30:39 +0100 Subject: [PATCH 13/15] Make linter happy --- scripts/download_import_cldr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 836cc7cf4..7047b390c 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -23,7 +23,7 @@ # presumably some locales will achieve Basic coverage in CLDR 50, we should keep # all the existing below-Basic coverage locales as is until CLDR 50 makes it # official. -# +# # The below-Basic locales have been moved to a separate file # ("cldr-exemplars-delta-49.zip"). This file however contains also ~1500 files # from the CLDR repository's `exemplars/` directory. These are locales that From 5f7c842315f3ad3c92e8a927f891576f68385f79 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Wed, 4 Nov 2026 20:38:19 +0100 Subject: [PATCH 14/15] Add docstring to test_locale_count --- tests/test_localedata.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_localedata.py b/tests/test_localedata.py index 9cfb253f9..ab2d114bc 100644 --- a/tests/test_localedata.py +++ b/tests/test_localedata.py @@ -185,6 +185,11 @@ def test_locale_identification(): def test_locale_count(): + """ + Smoke test to keep track of how many locales babel defines + now that CLDR 50 is planning to remove locales with below + Basic coverage. + """ assert len(localedata.locale_identifiers()) == 1147 From 18ce81e6c0f328a47128b1ce6479d5eac4e17b92 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Wed, 4 Nov 2026 20:42:18 +0100 Subject: [PATCH 15/15] Add a comment to explain a for-else block --- scripts/import_cldr.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py index 5c344af34..630255023 100755 --- a/scripts/import_cldr.py +++ b/scripts/import_cldr.py @@ -647,6 +647,7 @@ def _parse_zone_names(elem, ctxt): break names[child.tag] = str(child.text) else: + # No alias found in (meta)zone, use the names instead if names: info[width] = names return info