Skip to content

Commit e158422

Browse files
zhanweizhang7liuruibin
authored andcommitted
fix: Translate fixed name
1 parent 5cdc238 commit e158422

File tree

13 files changed

+51
-17
lines changed

13 files changed

+51
-17
lines changed

ui/src/components/folder-tree/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<div class="flex align-center">
4444
<AppIcon iconName="app-folder" style="font-size: 20px"></AppIcon>
4545
<span class="ml-8 ellipsis tree-label" style="max-width: 110px" :title="node.label">{{
46-
node.label
46+
i18n_name(node.label)
4747
}}</span>
4848
</div>
4949

@@ -103,6 +103,7 @@ import { onBeforeRouteLeave } from 'vue-router'
103103
import type { TreeInstance } from 'element-plus'
104104
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
105105
import { t } from '@/locales'
106+
import { i18n_name } from '@/utils/common'
106107
import folderApi from '@/api/folder'
107108
import { EditionConst } from '@/utils/permission/data'
108109
import { hasPermission } from '@/utils/permission/index'

ui/src/components/workspace-dropdown/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<el-button text style="font-size: 14px" class="workspace-dropdown__button">
99
<AppIcon iconName="app-workspace" style="font-size: 18px"></AppIcon>
1010
<span class="ellipsis" style="max-width: 155px" :title="currentWorkspace?.name">
11-
{{ currentWorkspace?.name }}
11+
{{ i18n_name(currentWorkspace?.name) }}
1212
</span>
1313
<el-icon class="el-icon--right">
1414
<CaretBottom />
@@ -55,6 +55,7 @@
5555

5656
<script setup lang="ts">
5757
import { watch, ref } from 'vue'
58+
import { i18n_name } from '@/utils/common'
5859
import type { WorkspaceItem } from '@/api/type/workspace'
5960
import useStore from '@/stores'
6061
const props = defineProps({

ui/src/locales/lang/en-US/layout.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export default {
2323
authorize: 'Authorized',
2424
inner_admin: 'System Admin',
2525
inner_wsm: 'Workspace Manager',
26-
inner_user: 'Common User',
26+
inner_user: 'Regular User',
27+
root: 'Root Directory',
28+
default_workspace: 'Default Workspace',
29+
default_user_group: 'Default User Group',
2730
},
2831
time: {
2932
daysLater: 'days later',

ui/src/locales/lang/zh-CN/layout.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export default {
2424
inner_admin: '系统管理员',
2525
inner_wsm: '工作空间管理员',
2626
inner_user: '普通用户',
27-
27+
root: '根目录',
28+
default_workspace: '默认工作空间',
29+
default_user_group: '默认用户组',
2830
},
2931
time: {
3032
daysLater: '天后',

ui/src/locales/lang/zh-Hant/layout.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export default {
2525
inner_admin: '系統管理員',
2626
inner_wsm: '工作空間管理員',
2727
inner_user: '普通用戶',
28+
root: '根目錄',
29+
default_workspace: '預設工作空間',
30+
default_user_group: '預設使用者群組',
2831
},
2932
time: {
3033
daysLater: '天後',

ui/src/utils/common.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {nanoid} from 'nanoid'
2+
import {t} from '@/locales'
23

34
/**
45
* 数字处理
@@ -85,6 +86,22 @@ export function downloadByURL(url: string, name: string) {
8586
document.body.removeChild(a)
8687
}
8788

89+
// 替换固定数据国际化
90+
const i18n_default_name_map:any = {
91+
"系统管理员": 'layout.about.inner_admin',
92+
"工作空间管理员": 'layout.about.inner_wsm',
93+
"普通用户": 'layout.about.inner_user',
94+
"根目录": 'layout.about.root',
95+
"默认工作空间": 'layout.about.default_workspace',
96+
"默认用户组": 'layout.about.default_user_group',
97+
}
98+
99+
export function i18n_name(name: string) {
100+
const key = i18n_default_name_map[name]
101+
return key ? t(key) : name
102+
}
103+
104+
88105
// 截取文件名
89106
export function cutFilename(filename: string, num: number) {
90107
const lastIndex = filename.lastIndexOf('.')

ui/src/views/application/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
</template>
178178
<template #subTitle>
179179
<el-text class="color-secondary lighter" size="small">
180-
{{ $t('common.creator') }}: {{ item.nick_name }}
180+
{{ $t('common.creator') }}: {{ i18n_name(item.nick_name) }}
181181
</el-text>
182182
</template>
183183
</CardBox>
@@ -197,7 +197,7 @@
197197
<template #subTitle>
198198
<el-text class="color-secondary lighter" size="small">
199199
<auto-tooltip :content="item.username">
200-
{{ $t('common.creator') }}: {{ item.nick_name }}
200+
{{ $t('common.creator') }}: {{ i18n_name(item.nick_name) }}
201201
</auto-tooltip>
202202
</el-text>
203203
</template>
@@ -330,6 +330,7 @@ import ApplicationApi from '@/api/application/application'
330330
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
331331
import useStore from '@/stores'
332332
import { t } from '@/locales'
333+
import { i18n_name } from '@/utils/common'
333334
import { useRouter, useRoute } from 'vue-router'
334335
import { isWorkFlow } from '@/utils/application'
335336
import { resetUrl } from '@/utils/common'

ui/src/views/knowledge/component/KnowledgeListContainer.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
</template>
170170
<template #subTitle>
171171
<el-text class="color-secondary lighter" size="small">
172-
{{ $t('common.creator') }}: {{ item.nick_name }}
172+
{{ $t('common.creator') }}: {{ i18n_name(item.nick_name) }}
173173
</el-text>
174174
</template>
175175
</CardBox>
@@ -190,7 +190,7 @@
190190
</template>
191191
<template #subTitle>
192192
<el-text class="color-secondary lighter" size="small">
193-
{{ $t('common.creator') }}: {{ item.nick_name }}
193+
{{ $t('common.creator') }}: {{ i18n_name(item.nick_name) }}
194194
</el-text>
195195
</template>
196196
<template #tag>
@@ -361,6 +361,7 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
361361
import useStore from '@/stores'
362362
import { numberFormat } from '@/utils/common'
363363
import { t } from '@/locales'
364+
import { i18n_name } from '@/utils/common'
364365
import { SourceTypeEnum } from '@/enums/common'
365366
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
366367
import permissionMap from '@/permission'

ui/src/views/model/component/ModelCard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</template>
2727
<template #subTitle>
2828
<el-text class="color-secondary lighter" size="small">
29-
{{ $t('common.creator') }}: {{ model.nick_name }}
29+
{{ $t('common.creator') }}: {{ i18n_name(model.nick_name) }}
3030
</el-text>
3131
</template>
3232
<template #tag>
@@ -145,6 +145,7 @@ import AuthorizedWorkspace from '@/views/system-shared/AuthorizedWorkspaceDialog
145145
import ResourceAuthorizationDrawer from '@/components/resource-authorization-drawer/index.vue'
146146
import { SourceTypeEnum } from '@/enums/common'
147147
import { t } from '@/locales'
148+
import { i18n_name } from '@/utils/common'
148149
import permissionMap from '@/permission'
149150
import { useRoute } from 'vue-router'
150151
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'

ui/src/views/system-chat-user/group/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
>
6060
<template #default="{ row }">
6161
<div class="flex-between">
62-
<span class="ellipsis" :title="row.name">{{ row.name }}</span>
62+
<span class="ellipsis" :title="row.name">{{ i18n_name(row.name) }}</span>
6363
<div @click.stop v-show="mouseId === row.id">
6464
<el-dropdown
6565
:teleported="false"
@@ -105,7 +105,7 @@
105105
<!-- 右边 -->
106106
<div class="user-right" v-loading="rightLoading">
107107
<div class="flex align-center">
108-
<h4 class="medium ellipsis" :title="current?.name">{{ current?.name }}</h4>
108+
<h4 class="medium ellipsis" :title="current?.name">{{ i18n_name(current?.name as string) }}</h4>
109109
<el-divider direction="vertical" class="mr-8 ml-8" />
110110
<AppIcon
111111
iconName="app-workspace"
@@ -269,6 +269,7 @@
269269
import { onMounted, ref, watch, reactive } from 'vue'
270270
import SystemGroupApi from '@/api/system/user-group'
271271
import { t } from '@/locales'
272+
import { i18n_name } from '@/utils/common'
272273
import type { ChatUserGroupUserItem } from '@/api/type/systemChatUser'
273274
import CreateOrUpdateGroupDialog from './component/CreateOrUpdateGroupDialog.vue'
274275
import CreateGroupUserDialog from './component/CreateGroupUserDialog.vue'

0 commit comments

Comments
 (0)