|
|
@@ -5,8 +5,6 @@ import { createI18n } from 'vue-i18n';
|
|
|
import { setHtmlPageLang, setLoadLocalePool } from './helper';
|
|
|
import { localeSetting } from '/@/settings/localeSetting';
|
|
|
import { useLocaleStoreWithOut } from '/@/store/modules/locale';
|
|
|
-// 默认语言静态导入,避免启动时动态 chunk 加载
|
|
|
-import zhCN from './lang/zh_CN';
|
|
|
|
|
|
const { fallback, availableLocales } = localeSetting;
|
|
|
|
|
|
@@ -15,8 +13,7 @@ export let i18n: ReturnType<typeof createI18n>;
|
|
|
async function createI18nOptions(): Promise<I18nOptions> {
|
|
|
const localeStore = useLocaleStoreWithOut();
|
|
|
const locale = localeStore.getLocale;
|
|
|
- // 默认语言使用静态导入的模块,其他语言动态加载
|
|
|
- const defaultLocal = locale === 'zh_CN' ? zhCN : await import(`./lang/${locale}.ts`);
|
|
|
+ const defaultLocal = await import(`./lang/${locale}.ts`);
|
|
|
const message = defaultLocal.default?.message ?? {};
|
|
|
|
|
|
setHtmlPageLang(locale);
|
|
|
@@ -32,7 +29,7 @@ async function createI18nOptions(): Promise<I18nOptions> {
|
|
|
[locale]: message,
|
|
|
},
|
|
|
availableLocales: availableLocales,
|
|
|
- sync: true, //If you don't want to inherit locale from global scope, you need to set sync of i18n component option to false.
|
|
|
+ sync: true, //If you don’t want to inherit locale from global scope, you need to set sync of i18n component option to false.
|
|
|
silentTranslationWarn: true, // true - warning off
|
|
|
missingWarn: false,
|
|
|
silentFallbackWarn: true,
|