entity/docs/i18n.md

23 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# entity 模块 i18n 说明
## 提取范围
本模块全部新增文案(页面标题、按钮、提示、错误码、字段名、过滤标签、消息)均已提取到 `wwwroot/i18n/`
| 文件 | 语言 | 用途 |
|------|------|------|
| `wwwroot/i18n/zh-CN.json` | 简体中文 | 默认语言 |
| `wwwroot/i18n/en-US.json` | 英文 | 英文界面 |
## key 规范
- 统一前缀 `entity.`(模块名),避免跨模块冲突。
- 分组:`entity.field.*`(字段标题)、`entity.filter.*`(搜索标签)、`entity.code.*`(错误码 message与后端 `{code, message, field, detail}` 结构对应)、`entity.msg.*`(操作消息)、`entity.import.*`(导入页文案)、`entity.list.*`(列表页文案)。
- 前端通过 bricks 的 `i18n('entity.xxx')` 调用(`i18n` 为 ahserver 注入全局)。
## 与后端错误码的对应
后端错误结构统一为 `{code, message, field, detail}`,其中 `code` 取值如 `ENTITY_VALIDATE_FAIL``IMPORT_VALIDATE_FAIL` 等。前端展示文案使用 `entity.code.<CODE>` 作为 key 查找 i18n`message` 字段为后端兜底文案(中文)。
## 新增文案流程
1.`wwwroot/i18n/zh-CN.json``en-US.json` 同时新增同 key。
2. 同步更新 `docs/i18n.md` 本说明(如 key 分组有变化)。
3. 部署时 i18n 文件随 wwwroot 一起链接到宿主应用 wwwroot。