Skip to content

Implement long/narrow -> short fallback in babel.units#1225

Open
trillllian wants to merge 2 commits intopython-babel:masterfrom
trillllian:master
Open

Implement long/narrow -> short fallback in babel.units#1225
trillllian wants to merge 2 commits intopython-babel:masterfrom
trillllian:master

Conversation

@trillllian
Copy link
Copy Markdown

Also implemented fallback from the correct pluralization to "other", which was also missing.

Fixes #1217.

@trillllian
Copy link
Copy Markdown
Author

hi, i noticed 2.18.0 was released recently. is there any chance someone could take a look at this PR? it is really not a complicated fix in my opinion, and this bug causes quite a few strings in our application to go untranslated. (well, currently it's not much of a problem since we are using babel 2.12 which has a much older CLDR, but it would be nice to upgrade.)

thanks for all the great work on babel regardless!

@akx akx self-requested a review April 10, 2026 07:07
Copy link
Copy Markdown
Member

@akx akx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one tiny performance note.

Sorry reviewing this had fallen through the cracks!

Also implemented fallback from the correct pluralization to "other",
which was also missing.

Fixes python-babel#1217.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.05%. Comparing base (dea267e) to head (f4000c1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1225      +/-   ##
==========================================
+ Coverage   92.04%   92.05%   +0.01%     
==========================================
  Files          27       27              
  Lines        4715     4721       +6     
==========================================
+ Hits         4340     4346       +6     
  Misses        375      375              
Flag Coverage Δ
macos-14-3.10 91.10% <100.00%> (+0.01%) ⬆️
macos-14-3.11 91.04% <100.00%> (+0.01%) ⬆️
macos-14-3.12 91.25% <100.00%> (+0.01%) ⬆️
macos-14-3.13 91.25% <100.00%> (+0.01%) ⬆️
macos-14-3.14 91.23% <100.00%> (+0.01%) ⬆️
macos-14-3.8 90.97% <100.00%> (+0.01%) ⬆️
macos-14-3.9 91.03% <100.00%> (+0.01%) ⬆️
macos-14-pypy3.10 91.10% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.10 91.12% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.11 91.06% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.12 91.27% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.13 91.27% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.14 91.25% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.8 90.99% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.9 91.05% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-pypy3.10 91.12% <100.00%> (+0.01%) ⬆️
windows-2022-3.10 91.11% <100.00%> (+0.01%) ⬆️
windows-2022-3.11 91.05% <100.00%> (+0.01%) ⬆️
windows-2022-3.12 91.26% <100.00%> (+0.01%) ⬆️
windows-2022-3.13 91.26% <100.00%> (+0.01%) ⬆️
windows-2022-3.14 91.24% <100.00%> (+0.01%) ⬆️
windows-2022-3.8 91.08% <100.00%> (+0.01%) ⬆️
windows-2022-3.9 91.04% <100.00%> (+0.01%) ⬆️
windows-2022-pypy3.10 91.11% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Aarni Koskela <akx@iki.fi>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants