babel icon indicating copy to clipboard operation
babel copied to clipboard

babel.units.format_unit does not fall back from long to short correctly

Open trillllian opened this issue 8 months ago • 0 comments

>>> import babel.units
>>> babel.units.format_unit(1, 'duration-month', 'long', locale='et')
'1 duration-month'  # should be: '1 kuu'

In CLDR for estonian, duration-month is only defined for 'short' and 'narrow' lengths. Before CLDR 44, it was also defined for 'long', but since then it has been aliased to the short version. It seems that pybabel does not understand these aliases properly, cf #1075, but the fix there was only for babel.dates, not for babel.units.

This happens for other locales and other (non-duration) units too.

trillllian avatar Jul 03 '25 02:07 trillllian