Skip to content

Commit 0b0bf6b

Browse files
committed
fix: i18n
1 parent d7d8eb0 commit 0b0bf6b

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

ui/src/layout/layout-header/avatar/index.vue

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
2424
<TagGroup
2525
size="small"
26-
:tags="user.userInfo?.role_name"
26+
:tags="role_list"
2727
v-if="hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')"
2828
/>
2929
</template>
@@ -150,9 +150,10 @@
150150
<!-- <UserPwdDialog ref="UserPwdDialogRef" /> -->
151151
</template>
152152
<script setup lang="ts">
153-
import {ref, onMounted} from 'vue'
153+
import {ref, onMounted, computed} from 'vue'
154154
import useStore from '@/stores'
155-
import {useRouter} from 'vue-router'
155+
import { useRouter } from 'vue-router'
156+
import {t} from "@/locales"
156157
import ResetPassword from './ResetPassword.vue'
157158
import AboutDialog from './AboutDialog.vue'
158159
// import UserPwdDialog from '@/views/user-manage/component/UserPwdDialog.vue'
@@ -185,7 +186,23 @@ function openAPIKeyDialog() {
185186
const openResetPassword = () => {
186187
resetPasswordRef.value?.open()
187188
}
188-
189+
const m:any = {
190+
"系统管理员": 'layout.about.inner_admin',
191+
"工作空间管理员": 'layout.about.inner_wsm',
192+
"普通用户":'layout.about.inner_user'
193+
}
194+
const role_list = computed(() => {
195+
if (!user.userInfo) {
196+
return []
197+
}
198+
return user.userInfo?.role_name?.map(name => {
199+
const inner = m[name]
200+
if (inner) {
201+
return t(inner)
202+
}
203+
return name
204+
})
205+
})
189206
const logout = () => {
190207
login.logout().then(() => {
191208
if (user?.userInfo?.source && ['CAS', 'OIDC', 'OAuth2'].includes(user.userInfo.source)) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export default {
2121
remark: 'Remarks',
2222
update: 'Update',
2323
authorize: 'Authorized',
24-
24+
inner_admin: 'System Admin',
25+
inner_wsm: 'Workspace Manager',
26+
inner_user: 'Common User',
2527
},
2628
time: {
2729
daysLater: 'days later',

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export default {
2020
serialNo: '序列号',
2121
remark: '备注',
2222
update: '更新',
23-
authorize: '授权给'
23+
authorize: '授权给',
24+
inner_admin: '系统管理员',
25+
inner_wsm: '工作空间管理员',
26+
inner_user: '普通用户',
27+
2428
},
2529
time: {
2630
daysLater: '天后',

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export default {
2121
serialNo: '序列號',
2222
remark: '備註',
2323
update: '更新',
24-
authorize: '授權給'
24+
authorize: '授權給',
25+
inner_admin: '系統管理員',
26+
inner_wsm: '工作空間管理員',
27+
inner_user: '普通用戶',
2528
},
2629
time: {
2730
daysLater: '天後',

0 commit comments

Comments
 (0)