Skip to content

docs: 主题显示价格按 zh-CN 格式化,兜住旧版 hub 存下的非法货币代码 - #35

Merged
stqfdyr merged 3 commits into
mainfrom
docs/currency-display
Oct 2, 2026
Merged

stqfdyr merged 3 commits into
mainfrom
docs/currency-display

Conversation

@stqfdyr

@stqfdyr stqfdyr commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

「主题开发」的价格一节:

  • 给出 money() 示例:Intl.NumberFormat 固定 zh-CN、小数最多两位,显示不随访客的浏览器语言变,美元、港币、日元写作 US$、HK$、JP¥
  • 先写明 hub 1.3.1 起货币才是三个大写字母;更早的 hub 不校验,旧数据可能不是三个字母,Intl 会抛错,要用 try/catch 兜住

lint / build 通过。

配套 monitor-probe/monitor#88

stqfdyr added a commit to monitor-probe/monitor that referenced this pull request Oct 2, 2026
面板节点列表的价格改用 `Intl.NumberFormat` 按 zh-CN 格式化,不再查五个币种的符号表。

- 符号或代码一律在数字前:`HK$38.00`、`NT$1,999.00`;中文里没有符号的写代码,如 `SGD 12.50`
- 美元由 `$` 改为 `US$`,与港币、新台币等其它「元」区分开;日元写作 `JP¥`、整数价格不带 `.00`,不再和人民币的 `¥` 相同
- 加千分位:`US$12,345.60`
- 小数最多两位,与价格的填写精度一致:日元填 `1200.5` 显示 `JP¥1,200.5`,不按日元的整数取整
- 地区固定为 zh-CN,不随浏览器语言变
- hub 1.3.1 之前不校验货币,旧数据里不是三个字母的值会让 `Intl` 抛错,这时照原样显示为 `港币 9.90`;hub 里「主题不必防抛错」的那句注释同步改正

面板 lint / test / build 与 `cargo fmt` 通过。浏览器语言设为 en-US,实测 CNY、USD、HKD、JPY、TWD、SGD、EUR 与一条非法旧值,1280 与 390 宽、深浅色下价格都单行显示。

配套 monitor-probe/monitor-theme-default#22、monitor-probe/monitor-theme-serverstatus#20、monitor-probe/monitor-document#35。

Closes #76
@stqfdyr
stqfdyr merged commit 9a95ffa into main Oct 2, 2026
1 check passed
@stqfdyr
stqfdyr deleted the docs/currency-display branch October 2, 2026 16:31
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

Successfully merging this pull request may close these issues.

1 participant