✨ 新增翻译文件
This commit is contained in:
parent
0350dca604
commit
c985a7ff83
@ -1,10 +1,11 @@
|
|||||||
import { createI18n } from 'vue-i18n'
|
import { createI18n } from 'vue-i18n'
|
||||||
// import useAppStore from '@/store/modules/app'
|
// import useAppStore from '@/store/modules/app'
|
||||||
import { listLangByLocale } from '@/api/system/commonLang'
|
import { listLangByLocale } from '@/api/system/commonlang.js'
|
||||||
import jsCookie from 'js-cookie'
|
import defaultSettings from '@/settings'
|
||||||
|
import cache from '@/plugins/cache'
|
||||||
const language = computed(() => {
|
const language = computed(() => {
|
||||||
// return useAppStore().lang
|
// return useAppStore().lang
|
||||||
return jsCookie.get('lang') || 'zh-cn'
|
return cache.local.get('lang') || defaultSettings.defaultLang
|
||||||
})
|
})
|
||||||
|
|
||||||
import zhCn from './lang/zh-cn.json'
|
import zhCn from './lang/zh-cn.json'
|
||||||
@ -24,7 +25,7 @@ const i18n = createI18n({
|
|||||||
// 全局注入 $t 函数
|
// 全局注入 $t 函数
|
||||||
globalInjection: true,
|
globalInjection: true,
|
||||||
fallbackLocale: 'zh-cn',
|
fallbackLocale: 'zh-cn',
|
||||||
locale: language.value, //默认选择的语言
|
locale: language.value, //默认选择的语言
|
||||||
legacy: false, // 使用 Composition API 模式,则需要将其设置为false
|
legacy: false, // 使用 Composition API 模式,则需要将其设置为false
|
||||||
messages: {
|
messages: {
|
||||||
'zh-cn': {
|
'zh-cn': {
|
||||||
@ -37,17 +38,17 @@ const i18n = createI18n({
|
|||||||
...pageLoginTw,
|
...pageLoginTw,
|
||||||
...pagemenuTw
|
...pagemenuTw
|
||||||
},
|
},
|
||||||
'en': {
|
en: {
|
||||||
...en,
|
...en,
|
||||||
...pageLoginEn,
|
...pageLoginEn,
|
||||||
...pagemenuEn
|
...pagemenuEn
|
||||||
},
|
}
|
||||||
//... 在这里添加其他语言支持
|
//... 在这里添加其他语言支持
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const loadLocale = () => {
|
const loadLocale = () => {
|
||||||
listLangByLocale(language.value).then(res => {
|
listLangByLocale(language.value).then((res) => {
|
||||||
const { code, data } = res
|
const { code, data } = res
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
i18n.global.mergeLocaleMessage(language.value, data)
|
i18n.global.mergeLocaleMessage(language.value, data)
|
||||||
@ -55,4 +56,4 @@ const loadLocale = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
loadLocale()
|
loadLocale()
|
||||||
export default i18n;
|
export default i18n
|
||||||
|
|||||||
@ -88,7 +88,8 @@
|
|||||||
"identity": "Identity",
|
"identity": "Identity",
|
||||||
"content1": "The code is completely free and open source, easy to read and understand, and the interface is simple and beautiful, giving you one more choice and reference for your project.",
|
"content1": "The code is completely free and open source, easy to read and understand, and the interface is simple and beautiful, giving you one more choice and reference for your project.",
|
||||||
"topNav": "Top nav",
|
"topNav": "Top nav",
|
||||||
"commonFuncs": "Common Functions"
|
"commonFuncs": "Common Functions",
|
||||||
|
"openWatermark": "Open Watermark"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"ok": "Ok",
|
"ok": "Ok",
|
||||||
|
|||||||
@ -88,7 +88,8 @@
|
|||||||
"identity": "身份",
|
"identity": "身份",
|
||||||
"content1": "代码完全免费开源,易读易懂、界面简洁美观,给你的项目多一种选择与参考。",
|
"content1": "代码完全免费开源,易读易懂、界面简洁美观,给你的项目多一种选择与参考。",
|
||||||
"topNav": "顶部导航",
|
"topNav": "顶部导航",
|
||||||
"commonFuncs": "常用功能"
|
"commonFuncs": "常用功能",
|
||||||
|
"openWatermark": "开启水印"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"ok": "确定",
|
"ok": "确定",
|
||||||
|
|||||||
@ -88,7 +88,8 @@
|
|||||||
"rewardUser": "打賞作者喝杯咖啡表示鼓勵",
|
"rewardUser": "打賞作者喝杯咖啡表示鼓勵",
|
||||||
"content1": "代碼完全免費開源,易讀易懂、界面簡潔美觀,給你的項目多一種選擇與參考。",
|
"content1": "代碼完全免費開源,易讀易懂、界面簡潔美觀,給你的項目多一種選擇與參考。",
|
||||||
"topNav": "頂部導航",
|
"topNav": "頂部導航",
|
||||||
"commonFuncs": "常用功能"
|
"commonFuncs": "常用功能",
|
||||||
|
"openWatermark": "開啟水印"
|
||||||
},
|
},
|
||||||
"common": {
|
"common": {
|
||||||
"ok": "確定",
|
"ok": "確定",
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>开启水印</span>
|
<span>{{ $t('layout.openWatermark') }}</span>
|
||||||
<span class="comp-style">
|
<span class="comp-style">
|
||||||
<el-switch v-model="showWatermark" class="drawer-switch" />
|
<el-switch v-model="showWatermark" class="drawer-switch" />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ const useAppStore = defineStore('app', {
|
|||||||
},
|
},
|
||||||
device: 'desktop',
|
device: 'desktop',
|
||||||
size: cache.local.get('size') || defaultSettings.defaultSize,
|
size: cache.local.get('size') || defaultSettings.defaultSize,
|
||||||
lang: cache.cookie.get('lang') || defaultSettings.defaultLang
|
lang: cache.local.get('lang') || defaultSettings.defaultLang
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
toggleSideBar() {
|
toggleSideBar() {
|
||||||
@ -40,7 +40,7 @@ const useAppStore = defineStore('app', {
|
|||||||
},
|
},
|
||||||
setLang(lang) {
|
setLang(lang) {
|
||||||
this.lang = lang
|
this.lang = lang
|
||||||
cache.cookie.set('lang', lang)
|
cache.local.set('lang', lang)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -66,7 +66,9 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
|
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:user:import']">
|
||||||
|
{{ $t('btn.import') }}
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:user:export']">
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:user:export']">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user