Skip to content

Update repo links - #2

Merged
hugovk merged 2 commits into
mainfrom
update-links
Apr 14, 2022
Merged

Update repo links#2
hugovk merged 2 commits into
mainfrom
update-links

Conversation

@hugovk

@hugovk hugovk commented Apr 14, 2022

Copy link
Copy Markdown
Member

Changes proposed in this pull request:

@hugovk hugovk added the changelog: Changed For changes in existing functionality label Apr 14, 2022
@codecov-commenter

codecov-commenter commented Apr 14, 2022

Copy link
Copy Markdown

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 ☂️

@hugovk
hugovk merged commit 368fd4f into main Apr 14, 2022
@hugovk
hugovk deleted the update-links branch April 14, 2022 12:48
@hugovk hugovk mentioned this pull request Apr 14, 2022
13 tasks
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 与测试预期
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Changed For changes in existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants