更新国际化文案

This commit is contained in:
whyour
2026-06-11 23:18:45 +08:00
parent 05f8fd3805
commit 6796068523
10 changed files with 26 additions and 13 deletions
+2 -2
View File
@@ -83,10 +83,10 @@ export default (app: Router) => {
!path.startsWith(config.configPath) &&
!path.startsWith(config.scriptPath)
) {
return res.send({ code: 403, message: '文件路径无效' });
return res.send({ code: 403, message: t('文件路径无效') });
}
await writeFileWithLock(path, content);
res.send({ code: 200, message: '保存成功' });
res.send({ code: 200, message: t('保存成功') });
} catch (e) {
return next(e);
}
+2 -1
View File
@@ -6,6 +6,7 @@ import config from '../config';
import SystemService from '../services/system';
import { celebrate, Joi } from 'celebrate';
import UserService from '../services/user';
import { t } from '../shared/i18n';
import {
getUniqPath,
handleLogPath,
@@ -401,7 +402,7 @@ export default (app: Router) => {
try {
const userService = Container.get(UserService);
await userService.resetAuthInfo(req.body);
res.send({ code: 200, message: '更新成功' });
res.send({ code: 200, message: t('更新成功') });
} catch (e) {
return next(e);
}
+4 -3
View File
@@ -8,6 +8,7 @@ import path from 'path';
import { v4 as uuidV4 } from 'uuid';
import rateLimit from 'express-rate-limit';
import config from '../config';
import { t } from '../shared/i18n';
import { isDemoEnv, getToken } from '../config/util';
const route = Router();
@@ -76,11 +77,11 @@ export default (app: Router) => {
async (req: Request, res: Response, next: NextFunction) => {
try {
if (isDemoEnv()) {
return res.send({ code: 450, message: '未知错误' });
return res.send({ code: 450, message: t('未知错误') });
}
const userService = Container.get(UserService);
await userService.updateUsernameAndPassword(req.body);
res.send({ code: 200, message: '更新成功' });
res.send({ code: 200, message: t('更新成功') });
} catch (e) {
return next(e);
}
@@ -229,7 +230,7 @@ export default (app: Router) => {
try {
const userService = Container.get(UserService);
await userService.updateUsernameAndPassword(req.body);
res.send({ code: 200, message: '更新成功' });
res.send({ code: 200, message: t('更新成功') });
} catch (e) {
return next(e);
}