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

format_currency with Japanese JPY does not shave decimals #139

Closed
achuinard opened this issue Jan 16, 2015 · 7 comments
Closed

format_currency with Japanese JPY does not shave decimals #139

achuinard opened this issue Jan 16, 2015 · 7 comments
Assignees
Milestone

Comments

@achuinard
Copy link

It is to my understanding that the Japanese Yen (JPY) does not use decimal places. Therefore, I'd say if I passed in a decimal to format_currency, and used ja_JP for the locale as well as JPY for the currency, I should get that decimal rounded.

Am I doing something wrong?

@benselme
Copy link
Member

You aren't doing anything wrong but this is not supported yet as far as I can tell.

Proper support for this would mean extracting currencyData/fractions data in CLDR's supplementalData.xml and then using it in format_currency.

@achuinard
Copy link
Author

If you could point me into where to start / look in the code and integrate this, I think I'll fork it and give it a try.

@benselme
Copy link
Member

Sure. The first step would be to import the data from the CLDR file. This happens in scripts/import_cldr.py. You'll need to understand what the data in the xml file means exactly, the specs for these elements are located here: http://www.unicode.org/reports/tr35/tr35-37/tr35-numbers.html#Supplemental_Currency_Data
Once you have imported the data, it's accessible through the get_global function.
Then you can modify format_currency to apply proper rounding where appropriate.

@benselme
Copy link
Member

Looks like some work was done in #120 but then the author closed the PR.

@achuinard
Copy link
Author

I'm a little discouraged from doing the work as it seems the project has been almost abandoned by the mitsuhiko. Why would a pull request like that just be 'closed'?

@benselme
Copy link
Member

FWIW #120 was closed by its own author.

But it's true that there hasn't been much activity recently and that PR and issues are piling up. I'm using my own fork in the meantime...

@etanol
Copy link
Contributor

etanol commented Mar 12, 2015

I don't remember now if I explicitly closed the pull request or GitHub did it when I renamed the branch. I normally use Mercurial so I have a very hard time tyring to work with Git and GitHub together.

Anyhow, I keep working on this branch when I need some fixes or improvements. For instance, these days I'm trying to improve the performance of the currency formatter, as we hit a bottleneck there at work. From time to time, I also check to see more attempts to upgrade to CLDR >= 26.

Currently, Armin seems to be more focused on Rust than on Python, so don't expect this repository to receive much attention. It's a bit fo a pity, since he took over the previous maintainer precisely for the same reason.

Fortunately, this is open source, so you can do as you please with it, just as I did.

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

4 participants