✨ 新增翻译文件
This commit is contained in:
+9
-8
@@ -1,10 +1,11 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
// import useAppStore from '@/store/modules/app'
|
||||
import { listLangByLocale } from '@/api/system/commonLang'
|
||||
import jsCookie from 'js-cookie'
|
||||
import { listLangByLocale } from '@/api/system/commonlang.js'
|
||||
import defaultSettings from '@/settings'
|
||||
import cache from '@/plugins/cache'
|
||||
const language = computed(() => {
|
||||
// return useAppStore().lang
|
||||
return jsCookie.get('lang') || 'zh-cn'
|
||||
return cache.local.get('lang') || defaultSettings.defaultLang
|
||||
})
|
||||
|
||||
import zhCn from './lang/zh-cn.json'
|
||||
@@ -24,7 +25,7 @@ const i18n = createI18n({
|
||||
// 全局注入 $t 函数
|
||||
globalInjection: true,
|
||||
fallbackLocale: 'zh-cn',
|
||||
locale: language.value, //默认选择的语言
|
||||
locale: language.value, //默认选择的语言
|
||||
legacy: false, // 使用 Composition API 模式,则需要将其设置为false
|
||||
messages: {
|
||||
'zh-cn': {
|
||||
@@ -37,17 +38,17 @@ const i18n = createI18n({
|
||||
...pageLoginTw,
|
||||
...pagemenuTw
|
||||
},
|
||||
'en': {
|
||||
en: {
|
||||
...en,
|
||||
...pageLoginEn,
|
||||
...pagemenuEn
|
||||
},
|
||||
}
|
||||
//... 在这里添加其他语言支持
|
||||
}
|
||||
})
|
||||
|
||||
const loadLocale = () => {
|
||||
listLangByLocale(language.value).then(res => {
|
||||
listLangByLocale(language.value).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
i18n.global.mergeLocaleMessage(language.value, data)
|
||||
@@ -55,4 +56,4 @@ const loadLocale = () => {
|
||||
})
|
||||
}
|
||||
loadLocale()
|
||||
export default i18n;
|
||||
export default i18n
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
"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.",
|
||||
"topNav": "Top nav",
|
||||
"commonFuncs": "Common Functions"
|
||||
"commonFuncs": "Common Functions",
|
||||
"openWatermark": "Open Watermark"
|
||||
},
|
||||
"common": {
|
||||
"ok": "Ok",
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
"identity": "身份",
|
||||
"content1": "代码完全免费开源,易读易懂、界面简洁美观,给你的项目多一种选择与参考。",
|
||||
"topNav": "顶部导航",
|
||||
"commonFuncs": "常用功能"
|
||||
"commonFuncs": "常用功能",
|
||||
"openWatermark": "开启水印"
|
||||
},
|
||||
"common": {
|
||||
"ok": "确定",
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
"rewardUser": "打賞作者喝杯咖啡表示鼓勵",
|
||||
"content1": "代碼完全免費開源,易讀易懂、界面簡潔美觀,給你的項目多一種選擇與參考。",
|
||||
"topNav": "頂部導航",
|
||||
"commonFuncs": "常用功能"
|
||||
"commonFuncs": "常用功能",
|
||||
"openWatermark": "開啟水印"
|
||||
},
|
||||
"common": {
|
||||
"ok": "確定",
|
||||
|
||||
Reference in New Issue
Block a user