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