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

How to set thousands and decimal separators to intword? #93

Open
aborruso opened this issue Jan 31, 2023 · 5 comments
Open

How to set thousands and decimal separators to intword? #93

aborruso opened this issue Jan 31, 2023 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@aborruso
Copy link
Contributor

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

@aborruso aborruso changed the title How to set thousands and decimal separator? How to set thousands and decimal separators? Jan 31, 2023
@hugovk
Copy link
Member

hugovk commented Feb 4, 2023

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:

# Mapping of locale to thousands separator
_THOUSANDS_SEPARATOR = {
"de_DE": ".",
"fr_FR": " ",
"pt_BR": ".",
}
# Mapping of locale to decimal separator
_DECIMAL_SEPARATOR = {
"de_DE": ",",
"pt_BR": ",",
}

Finally, intword doesn't yet use thousands_separator and decimal_separator. We should add support, perhaps similar to how intcomma does it: #53.

@aborruso
Copy link
Contributor Author

aborruso commented Feb 4, 2023

Second, for humanize.thousands_separator() and humanize.decimal_separator(), we need to add it_IT into:

Done #98

@aborruso
Copy link
Contributor Author

aborruso commented Feb 4, 2023

Finally, intword doesn't yet use thousands_separator and decimal_separator. We should add support, perhaps similar to how intcomma does it: #53.

I'm not able to open a PR about it :(

@hugovk
Copy link
Member

hugovk commented Feb 4, 2023

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.

@hugovk hugovk added the help wanted Extra attention is needed label Feb 4, 2023
@hugovk hugovk changed the title How to set thousands and decimal separators? How to set thousands and decimal separators to intword? Feb 4, 2023
@aborruso
Copy link
Contributor Author

aborruso commented Feb 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants