python-humanize / python-humanize/humanize
`intword` uses English units regardless of the active localization
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 756
- Forks
- 148
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 12
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the humanize.intword entry point with ja_JP activated through humanize.i18n.activate. Compare the reported Japanese outputs with the expected 万 and 億 forms, then determine how translations can provide locale-specific powers-of-ten names. Done means the examples produce the expected Japanese results without changing English behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- localization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100