i18n
This commit is contained in:
parent
bbbae267ca
commit
6f76bbfe9f
|
@ -5,7 +5,7 @@
|
|||
text-color="#fff">
|
||||
<el-submenu index="1" popper-class="submenu"
|
||||
v-permission="['org_admin', 'test_manager', 'test_user', 'test_viewer']">
|
||||
<template v-slot:title>【{{$t('commons.organization')}}】{{currentOrganizationName}}</template>
|
||||
<template v-slot:title>{{$t('commons.organization')}}: {{currentOrganizationName}}</template>
|
||||
<label v-for="(item,index) in organizationList" :key="index">
|
||||
<el-menu-item @click="changeOrg(item)">{{item.name}}
|
||||
<i class="el-icon-check"
|
||||
|
@ -14,7 +14,7 @@
|
|||
</label>
|
||||
</el-submenu>
|
||||
<el-submenu index="2" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
|
||||
<template v-slot:title>【{{$t('commons.workspace')}}】{{currentWorkspaceName}}</template>
|
||||
<template v-slot:title>{{$t('commons.workspace')}}: {{currentWorkspaceName}}</template>
|
||||
<label v-for="(item,index) in workspaceList" :key="index">
|
||||
<el-menu-item @click="changeWs(item)">
|
||||
{{item.name}}
|
||||
|
@ -52,8 +52,8 @@
|
|||
currentUserInfo: {},
|
||||
currentUserId: getCurrentUser().id,
|
||||
workspaceIds: [],
|
||||
currentOrganizationName: this.$t('organization.select'),
|
||||
currentWorkspaceName: this.$t('workspace.select')
|
||||
currentOrganizationName: '',
|
||||
currentWorkspaceName: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -10,21 +10,15 @@
|
|||
<font-awesome-icon class="icon global" :icon="['fas', 'globe']"/>
|
||||
<span>{{language}}</span>
|
||||
</template>
|
||||
<el-menu-item @click="changeLanguage('zh_CN')">
|
||||
简体中文<i class="el-icon-check" v-if="currentUserInfo.language==='zh_CN' || !currentUserInfo.language"/>
|
||||
</el-menu-item>
|
||||
<el-menu-item @click="changeLanguage('zh_TW')">
|
||||
繁體中文<i class="el-icon-check" v-if="currentUserInfo.language==='zh_TW'"/>
|
||||
</el-menu-item>
|
||||
<el-menu-item @click="changeLanguage('en_US')">
|
||||
English<i class="el-icon-check" v-if="currentUserInfo.language==='en_US'"/>
|
||||
<el-menu-item v-for="(value, key) in languageMap" :key="key" @click="changeLanguage(key)">
|
||||
{{value}} <i class="el-icon-check" v-if="language === value"/>
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {TokenKey, ZH_CN, ZH_TW, EN_US} from '../../../../common/js/constants';
|
||||
import {EN_US, TokenKey, ZH_CN, ZH_TW} from '../../../../common/js/constants';
|
||||
import {getCurrentUser} from "../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
|
@ -32,7 +26,12 @@
|
|||
data() {
|
||||
return {
|
||||
currentUserInfo: {},
|
||||
language: ''
|
||||
language: '',
|
||||
languageMap: {
|
||||
[ZH_CN]: '简体中文',
|
||||
[EN_US]: 'English',
|
||||
[ZH_TW]: '繁體中文',
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -41,6 +40,10 @@
|
|||
if (!lang) {
|
||||
lang = 'zh_CN';
|
||||
}
|
||||
this.checkLanguage(lang)
|
||||
},
|
||||
methods: {
|
||||
checkLanguage(lang) {
|
||||
this.$setLang(lang);
|
||||
switch (lang) {
|
||||
case ZH_CN:
|
||||
|
@ -57,7 +60,6 @@
|
|||
break;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
|
@ -66,9 +68,9 @@
|
|||
id: this.currentUser().id,
|
||||
language: language
|
||||
};
|
||||
this.checkLanguage(language);
|
||||
this.result = this.$post("/user/update/current", user, response => {
|
||||
localStorage.setItem(TokenKey, JSON.stringify(response.data));
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ export default {
|
|||
'personal_setting': 'Personal Setting',
|
||||
'test_resource_pool': 'Resource Pool',
|
||||
'system_setting': 'Settings',
|
||||
'api': 'Api test',
|
||||
'performance': 'Performance test',
|
||||
'api': 'Api',
|
||||
'performance': 'Performance',
|
||||
'functional': 'Functional test',
|
||||
'input_content': 'Please enter content',
|
||||
'create': 'Create',
|
||||
|
|
Loading…
Reference in New Issue