From bd77f3a1a6b341612949cd28237a4efbd2ce2bb4 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Wed, 6 Apr 2022 15:45:44 +0300
Subject: [PATCH] fix i18n for good??

---
 build/webpack.base.conf.js | 17 +++++++++--------
 src/i18n/messages.js       |  6 +++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index f8bd9902..f8c544d7 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -59,6 +59,15 @@ module.exports = {
           }
         }
       },
+      {
+        enforce: 'post',
+        test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
+        type: 'javascript/auto',
+        loader: '@intlify/vue-i18n-loader',
+        include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
+          path.resolve(__dirname, '../src/i18n')
+        ]
+      },
       {
         test: /\.vue$/,
         loader: 'vue-loader',
@@ -99,14 +108,6 @@ module.exports = {
           }
         }
       },
-      {
-        test: /\.(json5?|ya?ml)$/, // target json, json5, yaml and yml files
-        type: 'javascript/auto',
-        loader: '@intlify/vue-i18n-loader',
-        include: [ // Use `Rule.include` to specify the files of locale messages to be pre-compiled
-          path.resolve(__dirname, 'src/i18n')
-        ]
-      },
     ]
   },
   plugins: [
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 2a1161be..c5997230 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -32,7 +32,7 @@ const loaders = {
   pt: () => import('./pt.json'),
   ro: () => import('./ro.json'),
   ru: () => import('./ru.json'),
-  te: () => import('./te.json'),
+  //te: () => import('./te.json'), // buggy
   uk: () => import('./uk.json'),
   zh: () => import('./zh.json'),
   zh_Hant: () => import('./zh_Hant.json')
@@ -41,12 +41,12 @@ const loaders = {
 const messages = {
   languages: ['en', ...Object.keys(loaders)],
   default: {
-    en: require('./en.json')
+    en: require('./en.json').default
   },
   setLanguage: async (i18n, language) => {
     if (loaders[language]) {
       let messages = await loaders[language]()
-      i18n.setLocaleMessage(language, messages)
+      i18n.setLocaleMessage(language, messages.default)
     }
     i18n.locale = language
   }