humanize
humanize copied to clipboard
How to set thousands and decimal separators to `intword`?
What did you do?
Hi, in Italian the thousands separator is , (comma )and the decimal one is . (dot).
If I activate Italian - _t = humanize.i18n.activate("Italian") - and run humanize.intword(1234559), I get 1.2 milioni and not 1,2 milioni.
And If I run humanize.thousands_separator() I have ,.
What did you expect to happen?
To have Italian separators, i.e. have them inverted.
What actually happened?
I wrote it above
What versions are you using?
- OS: Debian 11
- Python: 3.9.2
- Humanize: 4.5.0
Thank you
Hi, we need three things.
First, use the language code "it_IT" rather than "Italian": humanize.i18n.activate("it_IT")
Second, for humanize.thousands_separator() and humanize.decimal_separator(), we need to add it_IT into:
https://github.com/python-humanize/humanize/blob/1feba83f1c0a64d63c15c52bdad75dfd064e8df8/src/humanize/i18n.py#L16-L27
Finally, intword doesn't yet use thousands_separator and decimal_separator. We should add support, perhaps similar to how intcomma does it: https://github.com/python-humanize/humanize/pull/53.
Second, for
humanize.thousands_separator()andhumanize.decimal_separator(), we need to addit_ITinto:
Done https://github.com/python-humanize/humanize/pull/98
Finally,
intworddoesn't yet usethousands_separatoranddecimal_separator. We should add support, perhaps similar to howintcommadoes it: #53.
I'm not able to open a PR about it :(
No problem, I'll have a look when I gave time, unless someone else would like to check it :) And thanks for the other PRs.
No problem, I'll have a look when I gave time, unless someone else would like to check it :) And thanks for the other PRs.
This is a great project, thank you very much