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

switch currency function from python locale to babel.numbers.format_currency #343

Open
nonprofittechy opened this issue Jan 12, 2021 · 1 comment

Comments

@nonprofittechy
Copy link
Contributor

This is thread safe and appears to be much easier to use when a single document switches back and forth between multiple currencies.

If this is of interest happy to submit a small PR

@jhpyle
Copy link
Owner

jhpyle commented Jan 16, 2021

I thought about using that function when I implemented currency() but I decided to go with the locale formatter even though it caused a thread safety issue. I don't remember all the reasons but one of them was that you need to pass the babel function a denomination, and while I could determine a denomination from get_territory_currencies(), sometimes that function returns multiple currencies, and then what do you do. Whereas with the OS there is an existing system for unambiguously mapping locale to currency, which is highly configurable. Also people still have lots of options because currency() accepts a symbol parameter and it is a language function that can be overridden.

In any case adopting the babel version could be a breaking change for people so I wouldn't implement it until a major version upgrade.

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

No branches or pull requests

2 participants