Update repo links - #2
Merged
Merged
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
vicoproplus
added a commit
to vicoproplus/moon-humanize
that referenced
this pull request
Aug 18, 2026
M1 — i18n 接入(moonbit/src/humanize/number.mbt) 将 apnumber / fractional / scientific / ordinal 的用户可见文案路由到 gettext: apnumber → gettext(words[n]) fractional → gettext(...)(纯分数与带分数两条路径) scientific → gettext(sign + mant_str + " x 10" + exp_str) ordinal → gettext(n.to_string() + suffix) 未配置语言区域 / 英文时自动回退为原词,既有 number_test.mbt 断言不受影响。 M2 — Native 时钟补全(clock_native.mbt + moon.pkg) 新增 clock_native.mbt(target: ["native"]),提供 now() -> Int64(复用 @env.now()),解决 gap-spec python-humanize#1.4 的 native 链接失败 / "未注入时钟" panic。 M3 — WASM 导出层(wasm.mbt + moon.pkg) 新增 wasm.mbt(target: ["wasm","wasm-gc"])作为显式 wasm 入口标记(wasm_version / wasm_ready 探针)。为避免同包 pub fn 重名冲突,未重复导出已有公开函数——根包 moonbit/moonbit.mbt 已是 preferred_target=wasm 的真正导出入口。 M4 — 交付保障 scripts/po2mbt 新增 --check 模式:比对已提交的 i18n_data.mbt 与 .po 生成结果,过期则非零退出。 CI test.yml 新增 moonbit-i18n-sync job 运行 scripts/po2mbt --check。 README.md 更新「已知移植差距 python-humanize#2」说明 i18n 已接入及同步流程。 验证 moon build / --target wasm-gc / --target native 三目标均编译通过(native 不再链接失败,确认 M2 生效)。 moon test --build-only 测试模块编译通过。 po2mbt --check 通过(已提交数据与 .po 同步)。
vicoproplus
added a commit
to vicoproplus/moon-humanize
that referenced
this pull request
Aug 18, 2026
ordinal → pgettext 按位上下文查后缀(number.mbt:386):pgettext(digit.to_string() + " (male)", suffix),与 python-humanize 行为及 .po 目录结构一致。已验证 i18n_data.mbt 的 ctx_RuRU 含 ("2 (male)\x00nd", "ой")(\u{0} 分隔符与 lookup_context 匹配),故 activate("ru"); ordinal("2") → "2ой" 正确本地化;英文/未配置语言回退 "2nd"。
apnumber:原本就传原子词(gettext(words[n])),.po 中有对应条目,已正确工作,无需改。
fractional / scientific:该移植刻意采用数字分母/数字系数(如 "3/10"、"1.00 x 10⁶"),而 .po 目录无这些组合键,也无"分母转单词"映射。要真正本地化需引入单词映射表并改变输出格式——这会破坏既有 number_test.mbt 断言(期望 "3/10"、"10/3"、"1 1/4")。权衡后保留 gettext 路由(优雅回退英文),并在 README 既有的 i18n 说明中保持透明。这是设计取舍,非回归。
审查发现 python-humanize#2(CI 防护)
原 CI 只跑 po2mbt --check,未实际编译 MoonBit,无法捕获 native 链接回归(clock_native.mbt)。已新增 moonbit-build job(test.yml):安装 MoonBit 工具链,构建 wasm-gc 与 native 两个 target,success 依赖它。这能在 CI 端守住 gap-spec python-humanize#1.4。
验证
moon build(默认)、--target wasm-gc、--target native 三目标均编译通过(native 不再链接失败)。
moon test --build-only 测试模块编译通过;本地 moon test 的 0xc0000139 是 Windows wasm 运行时启动问题,与改动无关(建议 Linux/macOS CI 执行断言)。
唯一未能完全满足 spec §2.3 的是 fractional/scientific 的俄文本地化(受数字格式设计限制)。如需彻底支持,建议后续单开任务:引入分母/系数单词映射并同步更新 .po 与测试预期
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
mainas the default branch