From 4e29918bac68e92a367bd8f7f02a8a51ca99aeae Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Fri, 21 Aug 2020 16:04:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20the=20i18n=20problem=20of=20router;=20:b?= =?UTF-8?q?ug:=20=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=B7=AF=E7=94=B1=E7=9A=84?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/i18n.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/i18n.js b/src/utils/i18n.js index f4e84f0..50e3c36 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -16,7 +16,6 @@ function initI18n(locale, fallback) { locale, fallbackLocale: fallback, silentFallbackWarn: true, - messages: routesI18n.messages } return new VueI18n(i18nOptions) } @@ -66,6 +65,10 @@ function mergeI18nFromRoutes(i18n, routes) { const US = generateI18n(new Object(), routes, 'path') i18n.mergeLocaleMessage('CN', CN) i18n.mergeLocaleMessage('US', US) + const messages = routesI18n.messages + Object.keys(messages).forEach(lang => { + i18n.mergeLocaleMessage(lang, messages[lang]) + }) } export {