update 升级@intlify/unplugin-vue-i18n版本依赖
update i18n使用方法。
add 新增i18n vite插件。
| | |
| | | "vue-types": "5.1.1" |
| | | }, |
| | | "devDependencies": { |
| | | "@iconify/json": "2.2.157", |
| | | "@intlify/unplugin-vue-i18n": "1.6.0", |
| | | "@iconify/json": "2.2.167", |
| | | "@intlify/unplugin-vue-i18n": "2.0.0", |
| | | "@types/crypto-js": "4.2.0", |
| | | "@types/file-saver": "2.0.5", |
| | | "@types/js-cookie": "3.0.5", |
| | |
| | | "unplugin-vue-setup-extend-plus": "1.0.0", |
| | | "vite-plugin-compression": "0.5.1", |
| | | "vite-plugin-svg-icons": "2.0.1", |
| | | "vitest": "0.29.7", |
| | | "vitest": "1.1.3", |
| | | "vue-eslint-parser": "9.3.2", |
| | | "vue-tsc": "0.35.0", |
| | | "vue-tsc": "1.8.27", |
| | | "vite": "5.0.10" |
| | | } |
| | | } |
| | |
| | | <template> |
| | | <el-config-provider :locale="appStore.locale" :size="size"> |
| | | <el-config-provider :locale="appStore.locale" :size="appStore.size"> |
| | | <router-view /> |
| | | </el-config-provider> |
| | | </template> |
| | |
| | | import useAppStore from '@/store/modules/app'; |
| | | |
| | | const appStore = useAppStore(); |
| | | const size = computed(() => appStore.size); |
| | | |
| | | onMounted(() => { |
| | | nextTick(() => { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "route": { |
| | | "dashboard": "Dashboard", |
| | | "document": "Document" |
| | | }, |
| | | "login": { |
| | | "username": "Username", |
| | | "password": "Password", |
| | | "login": "Login", |
| | | "code": "Verification Code", |
| | | "copyright": "" |
| | | }, |
| | | "navbar": { |
| | | "full": "Full Screen", |
| | | "language": "Language", |
| | | "dashboard": "Dashboard", |
| | | "document": "Document", |
| | | "message": "Message", |
| | | "layoutSize": "Layout Size", |
| | | "selectTenant": "Select Tenant", |
| | | "layoutSetting": "Layout Setting", |
| | | "personalCenter": "Personal Center", |
| | | "logout": "Logout" |
| | | } |
| | | } |
| | |
| | | // èªå®ä¹å½é
åé
ç½® |
| | | import { createI18n } from 'vue-i18n'; |
| | | |
| | | // æ¬å°è¯è¨å
|
| | | import enUSLocale from './en_US'; |
| | | import zhCNLocale from './zh_CN'; |
| | | import { LanguageEnum } from '@/enums/LanguageEnum'; |
| | | |
| | | const messages = { |
| | | zh_CN: { |
| | | ...zhCNLocale |
| | | }, |
| | | en_US: { |
| | | ...enUSLocale |
| | | } |
| | | }; |
| | | import messages from '@intlify/unplugin-vue-i18n/messages'; |
| | | |
| | | /** |
| | | * è·åå½åè¯è¨ |
| | |
| | | }; |
| | | |
| | | const i18n = createI18n({ |
| | | globalInjection: true, |
| | | legacy: false, |
| | | locale: getLanguage(), |
| | | messages |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "route": { |
| | | "dashboard": "é¦é¡µ", |
| | | "document": "é¡¹ç®ææ¡£" |
| | | }, |
| | | "login": { |
| | | "username": "ç¨æ·å", |
| | | "password": "å¯ç ", |
| | | "login": "ç» å½", |
| | | "code": "请è¾å
¥éªè¯ç ", |
| | | "copyright": "" |
| | | }, |
| | | "navbar": { |
| | | "full": "å
¨å±", |
| | | "language": "è¯è¨", |
| | | "dashboard": "é¦é¡µ", |
| | | "document": "é¡¹ç®ææ¡£", |
| | | "message": "æ¶æ¯", |
| | | "layoutSize": "å¸å±å¤§å°", |
| | | "selectTenant": "éæ©ç§æ·", |
| | | "layoutSetting": "å¸å±è®¾ç½®", |
| | | "personalCenter": "个人ä¸å¿", |
| | | "logout": "éåºç»å½" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'; |
| | | export default (path: any) => { |
| | | return VueI18nPlugin({ |
| | | include: [path.resolve(__dirname, '../../src/lang/**.json')] |
| | | }); |
| | | }; |
| | |
| | | import createSvgIconsPlugin from './svg-icon'; |
| | | import createCompression from './compression'; |
| | | import createSetupExtend from './setup-extend'; |
| | | import createI18n from './i18n'; |
| | | import path from 'path'; |
| | | |
| | | export default (viteEnv: any, isBuild = false): [] => { |
| | |
| | | vitePlugins.push(createIcons()); |
| | | vitePlugins.push(createSvgIconsPlugin(path, isBuild)); |
| | | vitePlugins.push(createSetupExtend()); |
| | | vitePlugins.push(createI18n(path)); |
| | | return vitePlugins; |
| | | }; |