添加 国际化框架

This commit is contained in:
2024-12-20 10:55:03 +08:00
parent b78740a239
commit fba29e0abc
139 changed files with 5297 additions and 8 deletions

View File

@@ -32,21 +32,31 @@
<el-dropdown-menu slot="dropdown">
<span style="display:block;" @click="show = true">
<el-dropdown-item>
布局设置
{{ $t('auto.common.Layout_setting') }}
</el-dropdown-item>
</span>
<router-link to="/user/center">
<el-dropdown-item>
个人中心
{{ $t('auto.common.Personal_center') }}
</el-dropdown-item>
</router-link>
<span style="display:block;" @click="open">
<el-dropdown-item divided>
退出登录
{{ $t('auto.common.Log_out') }}
</el-dropdown-item>
</span>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown class="right-menu-item" trigger="click" @command="langChange">
<span class="el-dropdown-link">
{{ language }} <i class="el-icon-caret-bottom" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item divided command="zh">简体中文</el-dropdown-item>
<el-dropdown-item divided command="en">English</el-dropdown-item>
<el-dropdown-item divided command="vi">Vietnamese</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</template>
@@ -77,10 +87,14 @@ export default {
Doc,
TopNav
},
created() {
this.setLang(localStorage.getItem('lang'))
},
data() {
return {
Avatar: Avatar,
dialogVisible: false
dialogVisible: false,
language: '简体中文'
}
},
computed: {
@@ -108,6 +122,22 @@ export default {
}
},
methods: {
// 中英文切换
langChange(command) {
this.$i18n.locale = command
localStorage.setItem('lang', command)
this.setLang(command)
location.reload()
},
setLang(command) {
if (command === 'en') {
this.language = 'English'
} else if (command === 'zh') {
this.language = '简体中文'
} else if (command === 'vi') {
this.language = 'Vietnamese'
}
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},