Skip to content

Commit f32c353

Browse files
hefanlihhhhsc701
andauthored
feature: complete the internationalization of collection pages (#316)
* feat: 增加错误码捕获抛出 * feature: increase internationalization and initially realize the internationalization of user login and registration related functions * feature: complete the internationalization of collection pages * fix: resolve the bug that tag value of status or syncMode will not change when changing the language * fix: delete gaussdb service in docker-compose file * fix: change '一次性执行' to '立即执行' --------- Co-authored-by: hhhhsc <1710496817@qq.com>
1 parent 5a8639e commit f32c353

File tree

23 files changed

+1283
-335
lines changed

23 files changed

+1283
-335
lines changed

frontend/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
🚀 快速开始
1+
## 🚀 快速开始
22

33
```
44
npm install # 安装依赖
55
npm run dev # 启动项目
66
npm run mock # 启动后台Mock服务(可选)
77
```
88

9-
📁 项目结构
9+
## 📁 项目结构
1010

1111
```
1212
frontend/
@@ -94,3 +94,10 @@ frontend/
9494
├── vite.config.ts # 开源协议
9595
└── pom.xml # Maven根配置
9696
```
97+
98+
## 开发新功能
99+
- 安装开发依赖:
100+
101+
```bash
102+
npm install xxx
103+
```

frontend/package-lock.json

Lines changed: 82 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
"@reduxjs/toolkit": "^2.11.2",
1515
"@xyflow/react": "^12.8.3",
1616
"antd": "^5.27.0",
17+
"i18next": "^25.8.0",
1718
"jssha": "^3.3.1",
1819
"lucide-react": "^0.539.0",
1920
"react": "^18.1.1",
2021
"react-dom": "^18.1.1",
2122
"react-force-graph-2d": "^1.29.0",
2223
"react-force-graph-3d": "^1.29.0",
24+
"react-i18next": "^16.5.4",
2325
"react-markdown": "^10.1.0",
2426
"react-redux": "^9.2.0",
2527
"react-router": "^7.8.0",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"400": "请求参数错误",
3+
"401": "登录已过期,请重新登录",
4+
"403": "没有权限访问该资源",
5+
"404": "请求的资源不存在",
6+
"500": "服务器内部错误,请稍后重试",
7+
"502": "网关错误",
8+
"op.0001": "不支持的文件类型",
9+
"op.0002": "算子中缺少元数据文件",
10+
"op.0003": "缺少必要的字段",
11+
"op.0004": "settings字段解析失败",
12+
"op.0005": "算子ID已存在",
13+
"op.0006": "算子名称已存在",
14+
"op.0007": "算子已被编排在模板或未完成的任务中",
15+
"op.0008": "预置算子无法删除",
16+
"clean.0001": "清洗任务名称重复",
17+
"clean.0002": "任务列表为空",
18+
"clean.0003": "算子输入输出不匹配",
19+
"clean.0004": "算子执行器不匹配"
20+
}

frontend/src/i18n/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import i18n from 'i18next';
2+
import { initReactI18next } from 'react-i18next';
3+
import zhCommon from './locales/zh/common.json';
4+
import enCommon from './locales/en/common.json';
5+
6+
// Get saved language from localStorage, default to 'zh'
7+
const savedLanguage = localStorage.getItem('language') || 'zh';
8+
9+
i18n
10+
.use(initReactI18next)
11+
.init({
12+
resources: {
13+
zh: {
14+
common: zhCommon,
15+
},
16+
en: {
17+
common: enCommon,
18+
},
19+
},
20+
lng: savedLanguage,
21+
fallbackLng: 'zh',
22+
ns: ['common'],
23+
defaultNS: 'common',
24+
interpolation: {
25+
escapeValue: false,
26+
},
27+
});
28+
29+
export default i18n;

0 commit comments

Comments
 (0)