国际化
RuleGo-Server 支持多语言国际化,包括后端语言包管理 API 和前端编辑器的国际化。
# 后端语言包 API
# 列出语言包
GET /api/v1/locales
Authorization: Bearer {token}
1
2
2
返回所有已注册的语言包列表。
# 获取指定语言包
GET /api/v1/locales?lang=zh-CN
Authorization: Bearer {token}
1
2
2
# 保存/更新语言包
POST /api/v1/locales
Authorization: Bearer {token}
Content-Type: application/json
{
"lang": "zh-CN",
"data": {
"key": "值",
"node.filter": "过滤器"
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
语言包数据存储在 data/locales/ 目录下。
# 权限
| 操作 | 所需权限 |
|---|---|
| 查看语言包 | locale:read |
| 修改语言包 | locale:write |
# 前端编辑器国际化
RuleGo-Editor 前端同样支持国际化,可以自定义组件名称、表单标签、分类名称、提示信息等文本内容。
详细文档请参考:RuleGo-Editor 国际化 (opens new window)
# 快速使用
通过 options.locales 传入自定义语言包:
<RuleGoEditor :data="data" :options="options"/>
<script setup>
const options = ref({
locales: {
category: {
filter: { label: '过滤器', background: '#f1e861', nodeType: 'simple-node' }
},
component: {
nodes: {
jsFilter: { label: 'JS过滤', desc: '使用js脚本过滤消息' }
}
},
relationTypes: { 'Success': '成功', 'Failure': '失败' }
}
});
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 语言包结构
| 字段 | 说明 |
|---|---|
category | 组件分类配置(名称、背景色、节点类型) |
component.endpoints | 输入端组件定义(标签、图标、表单字段) |
component.nodes | 规则链节点组件定义 |
relationTypes | 连接关系类型翻译(Success、Failure 等) |
| 其他字符串 | 通用文本翻译(如 'Input': '输入') |
更多详情请查看 editor.rulego.cc (opens new window)。
在 GitHub 上编辑此页 (opens new window)
上次更新: 2026/06/02, 01:16:21