优化翻译

This commit is contained in:
2026-03-19 14:43:08 +08:00
parent f63616e735
commit db0e420a8f
6 changed files with 113 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
{
"search": {
"deptName": "Dept Name",
"deptName": "channel(Department) Name",
"deptCode": "Dept Code",
"status": "Status",
"placeholderDeptName": "Please enter dept name",
@@ -8,11 +8,32 @@
"searchSelectPlaceholder": "Please select"
},
"table": {
"deptName": "Dept Name",
"deptName": "channel(Department) Name",
"deptCode": "Dept Code",
"leader": "Leader",
"sort": "Sort",
"status": "Status",
"createTime": "Create Time"
},
"form": {
"titleAdd": "Add Department",
"titleEdit": "Edit Department",
"labelParentDept": "Parent Department",
"labelDeptName": "Dept Name",
"labelDeptCode": "Dept Code",
"labelLeader": "Leader",
"labelRemark": "Description",
"labelSort": "Sort",
"labelStatus": "Enabled",
"placeholderDeptName": "Please enter dept name",
"placeholderDeptCode": "Please enter dept code",
"placeholderRemark": "Please enter description",
"placeholderSort": "Please enter sort",
"noParentDept": "No parent department",
"ruleParentDeptRequired": "Please select parent department",
"ruleDeptNameRequired": "Please enter dept name",
"ruleDeptCodeRequired": "Please enter dept code",
"addSuccess": "Added successfully",
"editSuccess": "Updated successfully"
}
}

View File

@@ -323,7 +323,7 @@
"role": "角色管理",
"userCenter": "个人中心",
"menu": "菜单管理",
"dept": "部门管理",
"dept": "渠道(部门)管理",
"post": "岗位管理",
"config": "系统配置"
},

View File

@@ -1,6 +1,6 @@
{
"search": {
"deptName": "部门名称",
"deptName": "渠道(部门)名称",
"deptCode": "部门编码",
"status": "状态",
"placeholderDeptName": "请输入部门名称",
@@ -8,11 +8,32 @@
"searchSelectPlaceholder": "请选择"
},
"table": {
"deptName": "部门名称",
"deptName": "渠道(部门)名称",
"deptCode": "部门编码",
"leader": "部门领导",
"sort": "排序",
"status": "状态",
"createTime": "创建时间"
},
"form": {
"titleAdd": "新增部门",
"titleEdit": "编辑部门",
"labelParentDept": "上级部门",
"labelDeptName": "部门名称",
"labelDeptCode": "部门编码",
"labelLeader": "部门领导",
"labelRemark": "描述",
"labelSort": "排序",
"labelStatus": "启用",
"placeholderDeptName": "请输入部门名称",
"placeholderDeptCode": "请输入部门编码",
"placeholderRemark": "请输入部门描述",
"placeholderSort": "请输入排序",
"noParentDept": "无上级部门",
"ruleParentDeptRequired": "请选择上级部门",
"ruleDeptNameRequired": "请输入部门名称",
"ruleDeptCodeRequired": "请输入部门编码",
"addSuccess": "新增成功",
"editSuccess": "修改成功"
}
}

View File

@@ -43,14 +43,33 @@ export async function loadPageLocale(routePath: string): Promise<void> {
return
}
const locale = getCurrentLocale()
const key = getModuleKey(locale, path)
const modules = locale === LanguageEnum.EN ? enModules : zhModules
const loader = modules[key]
const tryPaths: string[] = [path]
// 兼容别名路由:例如 /user 实际页面为 /system/user
if (!path.includes('/')) {
tryPaths.push(`system/${path}`)
}
if (path === 'user') {
tryPaths.push('system/user')
}
let matchedPath: string | null = null
let loader: (() => Promise<PageLocaleModule>) | undefined
for (const p of tryPaths) {
const key = getModuleKey(locale, p)
const l = modules[key]
if (l) {
matchedPath = p
loader = l
break
}
}
if (!loader) {
clearPageLocale()
return
}
if (lastLoadedPath === path && lastLoadedLocale === locale) {
if (lastLoadedPath === matchedPath && lastLoadedLocale === locale) {
return
}
try {
@@ -58,7 +77,7 @@ export async function loadPageLocale(routePath: string): Promise<void> {
const message = mod?.default
if (message && typeof message === 'object') {
i18n.global.mergeLocaleMessage(locale, { page: message })
lastLoadedPath = path
lastLoadedPath = matchedPath
lastLoadedLocale = locale
}
} catch {