Skip to content

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

@trillllian

Description

@trillllian
>>> 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions