国际化

This commit is contained in:
2025-06-27 17:07:21 +08:00
parent 0a28e86ec2
commit 322144359f
6 changed files with 27 additions and 30 deletions

View File

@@ -51,9 +51,9 @@ export default {
]
},
languages: [
{label: '中文', value: 'zh'},
{label: 'English', value: 'en'},
{label: 'Español', value: 'es'}
{label: '中文', value: 'zh-cn'},
{label: 'English', value: 'en-us'}
// {label: 'Español', value: 'es'}
],
visible: false,
layout: 'normal',
@@ -66,6 +66,11 @@ export default {
},
methods: {
init () {
if (this.$i18n.locale === 'zh-cn') {
this.dataForm.selectedLanguage = 'zh-cn'
} else if (this.$i18n.locale === 'en-us') {
this.dataForm.selectedLanguage = 'en-us'
}
this.dialogVisible = true
},
exitUser () {
@@ -75,6 +80,8 @@ export default {
dataFormSubmit () {
this.dialogVisible = false
this.visible = false
this.$i18n.locale = this.dataForm.selectedLanguage
window.localStorage.setItem('locale', this.dataForm.selectedLanguage)
},
handleClose (done) {
this.visible = false

View File

@@ -1,17 +1,17 @@
<template>
<div class="zbox body-container" :class="{'enClass': selectType === 'en-us'}">
<div class="zbox body-container" :class="{'enClass': $i18n.locale === 'en-us'}">
<el-row type="flex" class="header-container" justify="space-between" align="middle">
<el-col :span="3">
<el-button type="primary" icon="el-icon-s-home" class="button-home" @click="$router.push('/index/home')">主页</el-button>
<el-button type="primary" icon="el-icon-s-home" class="button-home" @click="$router.push('/index/home')">{{ $t('homeinfo.index') }}</el-button>
</el-col>
<el-col :span="12">
<el-row type="flex" justify="end" align="middle">
<div class="state-item">自动模式</div>
<div class="state-item">执行中</div>
<div class="relative elec-qty-wrap elec-wraning">
<div class="absolute elec-qty" style="width: 62%"></div>
<div class="relative elec-qty-wrap">
<div class="absolute elec-qty" style="width: 50%"></div>
<div class="absolute elec-qty-border"></div>
<div class="elec-txt">38%</div>
<div class="elec-txt">50%</div>
</div>
<i class="el-icon-user-solid icon-user" :style="{'color': isUsed ? '#00ff29' : '#737f92'}" @click="loginModalHandle"></i>
<i class="el-icon-s-tools icon-tools" @click="configModalHandle"></i>
@@ -52,13 +52,6 @@ export default {
configVisible: false
}
},
created () {
if (this.$i18n.locale === 'zh-cn') {
this.selectType = 'zh-cn'
} else if (this.$i18n.locale === 'en-us') {
this.selectType = 'en-us'
}
},
mounted () {
this.checkTextOverflow()
window.addEventListener('resize', this.checkTextOverflow)