Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer LC_MONETARY when formatting currencies #1173

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

akx
Copy link
Member

@akx akx commented Jan 14, 2025

POSIX defines the LC_MONETARY category to be used for monetary formatting, hence Babel could be more standards-compliant in this regard.

Closes #1051 (supersedes it).

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.34%. Comparing base (0c1091c) to head (22e39d0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1173      +/-   ##
==========================================
+ Coverage   91.33%   91.34%   +0.01%     
==========================================
  Files          27       27              
  Lines        4650     4657       +7     
==========================================
+ Hits         4247     4254       +7     
  Misses        403      403              
Flag Coverage Δ
macos-14-3.10 ?
macos-14-3.11 ?
macos-14-3.12 90.50% <100.00%> (+0.01%) ⬆️
macos-14-3.13 90.50% <100.00%> (+0.01%) ⬆️
macos-14-3.8 90.22% <100.00%> (+0.01%) ⬆️
macos-14-3.9 90.28% <100.00%> (+0.01%) ⬆️
macos-14-pypy3.10 90.35% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.10 ?
ubuntu-24.04-3.11 90.31% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.12 90.53% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.13 90.53% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.8 90.24% <100.00%> (+0.01%) ⬆️
ubuntu-24.04-3.9 ?
ubuntu-24.04-pypy3.10 90.38% <100.00%> (+0.01%) ⬆️
windows-2022-3.10 90.39% <100.00%> (+0.01%) ⬆️
windows-2022-3.11 90.32% <100.00%> (+0.01%) ⬆️
windows-2022-3.12 90.54% <100.00%> (+0.01%) ⬆️
windows-2022-3.13 90.54% <100.00%> (+0.01%) ⬆️
windows-2022-3.8 90.36% <100.00%> (+0.01%) ⬆️
windows-2022-3.9 90.32% <100.00%> (+0.01%) ⬆️
windows-2022-pypy3.10 90.39% <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.

@akx akx marked this pull request as ready for review January 14, 2025 16:46
@akx akx requested a review from tomasr8 January 15, 2025 13:09
@tomasr8
Copy link
Member

tomasr8 commented Jan 16, 2025

I'll take a look later today ;)

Copy link
Member

@tomasr8 tomasr8 left a comment

Choose a reason for hiding this comment

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

I just have two questions, the rest looks good to me :)

else:
raise TypeError(f"Invalid type for category: {category!r}")

for name in varnames:
Copy link
Member

Choose a reason for hiding this comment

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

This will technically try to look up an empty string now when using default_locale('') or default_locale(['']) but I guess that's a rare-enough case?

if isinstance(category, str):
varnames = (category, *varnames)
elif isinstance(category, (list, tuple)):
varnames = (*category, *varnames)
Copy link
Member

Choose a reason for hiding this comment

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

Should calls like default_locale([None]) work without raising? (os.getenv raises for None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants