Skip to content

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

Description

@aborruso

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

Activity

  1. changed the title [-]How to set thousands and decimal separator?[/-] [+]How to set thousands and decimal separators?[/+] on Jan 31, 2023
  2. hugovk commented on Feb 4, 2023

    @hugovk
    Member

    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.

  3. aborruso commented on Feb 4, 2023

    @aborruso
    ContributorAuthor

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

    Done #98

  4. aborruso commented on Feb 4, 2023

    @aborruso
    ContributorAuthor

    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 :(

  5. hugovk commented on Feb 4, 2023

    @hugovk
    Member

    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.

  6. changed the title [-]How to set thousands and decimal separators?[/-] [+]How to set thousands and decimal separators to `intword`?[/+] on Feb 4, 2023
  7. aborruso commented on Feb 4, 2023

    @aborruso
    ContributorAuthor

    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

  8. hugovk commented on Dec 20, 2025

    @hugovk
    Member

    Done in #287.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions