python-humanize / python-humanize/humanize

`intword` uses English units regardless of the active localization

未关闭
#181 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

help wanted
主要语言
Python
星标
756
派生
148
平均合并
6 天 1 小时
30 天内合并 PR
12

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从通过 humanize.i18n.activate 激活 ja_JP 的 humanize.intword 入口点开始。将报告的日语输出与预期的 万 和 億 形式进行比较,然后确定翻译如何提供特定于 locale 的十的幂名称。完成意味着示例会产生预期的日语结果,同时不改变英语行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
localization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。