feat(i18n): 添加中文和英文语言文件,集成国际化支持
Some checks failed
/ build-and-deploy-to-vercel (push) Failing after 1m10s
/ playwright (push) Successful in 2m34s
/ depcheck (push) Successful in 1m39s

This commit is contained in:
严浩
2024-11-06 18:28:53 +08:00
parent 40752e555f
commit ec1d932250
8 changed files with 269 additions and 23 deletions

View File

@ -1,3 +1,4 @@
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import { unheadVueComposablesImports } from '@unhead/vue';
import { VantResolver } from '@vant/auto-import-resolver';
import Vue from '@vitejs/plugin-vue';
@ -22,6 +23,7 @@ import cdnImport from 'vite-plugin-cdn-import';
import { vitePluginFakeServer } from 'vite-plugin-fake-server';
import vueDevTools from 'vite-plugin-vue-devtools';
import { ViteWebfontDownload } from 'vite-plugin-webfont-dl';
import { resolve, dirname } from 'node:path';
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
@ -138,6 +140,17 @@ function Plugins() {
enableProd: true,
}),
);
plugins.push(
VueI18nPlugin({
include: resolve(dirname(fileURLToPath(import.meta.url)), './src/locales/**'),
// 可选:指定语言文件格式,默认为 json
// runtimeOnly: false,
// compositionOnly: false,
// fullInstall: true
}),
);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const unused = () => {
plugins.push(