mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
Synchronize both language guides, API references and examples with the implemented authorization, storage and delivery behavior. Document migration requirements and accepted operational limits.
27 lines
1.5 KiB
Markdown
27 lines
1.5 KiB
Markdown
# 消息语言(i18n)
|
||
|
||
消息按每个分组配置的语言渲染。WebHooker 内置**英文**(默认)与**简体中文**两套字典。
|
||
|
||
## 分组语言
|
||
|
||
设置 `Group.lang`(如 `"zh"`)可为分组内所有路由选择消息语言——见[分组 → 分组模式](./groups#分组模式)。分组的 webhook 日志频道摘要使用相同的语言。
|
||
|
||
## 自定义覆盖
|
||
|
||
额外的消息语言从 KV 键 `i18n:<lang>` 读取:一个与内置字典(`server/lib/lib/locales/en.ts`)嵌套结构相同的 JSON 对象,未提供的键都会回退为英文。内置的 `en` 与 `zh` 不会从 KV 读取,因此不能这样覆盖;请使用其他语言代码(如 `zh-custom`),并把它设为分组的 `lang`。
|
||
|
||
```jsonc
|
||
// KV 键:i18n:zh-custom
|
||
{
|
||
"events": {
|
||
"push": { "title": "{repo}: 推送了 {count} 个提交到 {ref}" },
|
||
},
|
||
}
|
||
```
|
||
|
||
已加载的字典会在每个 worker 实例中一直缓存到实例重启,因此修改后的覆盖可能要过一段时间才生效;没有覆盖的语言 5 分钟后会再次查找。覆盖只影响分组消息——控制台使用其内置的翻译。
|
||
|
||
## 表情开关
|
||
|
||
`Group.emoji`(默认 `true`)控制该分组消息中是否显示事件表情。关闭后,格式化器添加到标题、描述、字段与链接中的表情都不会出现;取自载荷的文本(提交信息、issue 标题、自定义 webhook 字段)保留其中自带的表情。里程碑进度条(🟢🟡🟠⬜)属于数据可视化,不受该开关影响。
|