默认加载所有语言文件

This commit is contained in:
q4speed 2020-05-14 14:33:38 +08:00
parent 43183f4ba5
commit 96a70308e3
1 changed files with 7 additions and 3 deletions

View File

@ -5,19 +5,23 @@ import enLocale from "element-ui/lib/locale/lang/en";
import zh_CNLocale from "element-ui/lib/locale/lang/zh-CN"; import zh_CNLocale from "element-ui/lib/locale/lang/zh-CN";
import zh_TWLocale from "element-ui/lib/locale/lang/zh-TW"; import zh_TWLocale from "element-ui/lib/locale/lang/zh-TW";
import zh_CN from "./zh-CN"; import zh_CN from "./zh-CN";
import en_US from "./en-US";
import zh_TW from "./zh-TW";
Vue.use(VueI18n); Vue.use(VueI18n);
const messages = { const messages = {
'en_US': { 'en_US': {
...enLocale ...enLocale,
...en_US
}, },
'zh_CN': { 'zh_CN': {
...zh_CNLocale, ...zh_CNLocale,
...zh_CN ...zh_CN
}, },
'zh_TW': { 'zh_TW': {
...zh_TWLocale ...zh_TWLocale,
...zh_TW
} }
}; };
@ -26,7 +30,7 @@ const i18n = new VueI18n({
messages, messages,
}); });
const loadedLanguages = ['zh_CN']; const loadedLanguages = ['en_US', 'zh_CN', 'zh_TW'];
function setI18nLanguage(lang) { function setI18nLanguage(lang) {
i18n.locale = lang; i18n.locale = lang;