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

intword uses English units regardless of the active localization #181

Open
TellowKrinkle opened this issue Mar 12, 2024 · 1 comment
Open

Comments

@TellowKrinkle
Copy link

Not all languages group large numbers into A103 + B106, etc. For example, Japanese has no word for 106. Instead, it has a word for 104, and 106 is written as 100 of those. Unsurprisingly, 2e7 is not written 20 × 100 × 104, but as 2000 × 104. Translations should be able to specify which powers of 10 have special names.

What did you do?

>>> import humanize
>>> humanize.i18n.activate("ja_JP")
<gettext.GNUTranslations object at 0x102fcca00>
>>> humanize.intword(234909023)
'234.9 百万'
>>> humanize.intword(2349090)
'2.3 百万'

What did you expect to happen?

>>> humanize.intword(234909023)
'2.3億'
>>> humanize.intword(2349090)
'234.9万'

What actually happened?

>>> humanize.intword(234909023)
'234.9 百万'
>>> humanize.intword(2349090)
'2.3 百万'

(This is the equivalent of putting in 23490902 and getting "234.9 hundred thousand" in English)

What versions are you using?

  • OS: Fedora 39
  • Python: 3.12
  • Humanize: 4.9.0
@hugovk
Copy link
Member

hugovk commented Mar 12, 2024

Thanks for the report. I'm not sure how well suited this library is to adapt for this, but would review a PR if you'd like to look into it.

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