]> git.ipfire.org Git - thirdparty/babel.git/commit
Import aliases from CLDR data and use them better systemic-aliases 1310/head
authorAarni Koskela <akx@iki.fi>
Fri, 31 Jul 2026 09:56:06 +0000 (12:56 +0300)
committerAarni Koskela <akx@iki.fi>
Fri, 31 Jul 2026 19:19:03 +0000 (22:19 +0300)
commitfcb73a0cc11c19f7da700dc69e0a55ed97ef3ec1
treeced4ed1381356e1920e84337166082beeb391182
parentc874ed6cacb35f4c94786a264678b2020b3fb3d4
Import aliases from CLDR data and use them better

We had some manual fallbacks for missing field/unit lengths,
and ignored many `<alias>`es in CLDR data entirely.

This PR imports those aliases and uses them to resolve missing lengths,
improving output in corner cases and fixes some rare KeyError crashes too.

There's a quirk related to person-variant unit aliases,
which are only expressed in CLDR for the short length.
If one follows the spec to the letter,
a request for a long/narrow person-variant unit will route
through the short length and lose the requested length.
We use the same "workaround" as ICU to preserve the length,
by importing these as whole-unit aliases. Not totally spec-
compliant, but the end result is simply better.

Fixes #1076
babel/dates.py
babel/units.py
scripts/import_cldr.py
tests/test_dates.py
tests/test_numbers.py
tests/test_units.py