From 683f19a8632a197353cc40068a9a7a0de8ed727b Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Thu, 18 Apr 2024 12:53:22 +0800
Subject: [PATCH] 1

---
 src/locales/index.js |   46 +++++++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/src/locales/index.js b/src/locales/index.js
index 03ae48a..baf53dc 100644
--- a/src/locales/index.js
+++ b/src/locales/index.js
@@ -1,46 +1,62 @@
 import Vue from "vue";
 import VueI18n from "vue-i18n";
-import zh from "./zh.js";
-import en from "./en.js";
+import en from "./en.json";
+import india from "@/locales/hi.json";
+import tw from "@/locales/cht.json";
+import ty from "@/locales/th.json";
+import ry from "@/locales/jp.json";
+import hy from "@/locales/kor.json";
 
 Vue.use(VueI18n);
 
-const DEFAULT_LANG = "zh";
+const DEFAULT_LANG = "zh-CN";
 const LOCALE_KEY = "language";
 
 const locales = {
-  zh: {
-    ...zh
-  },
   en: {
-    ...en
-  }
+    ...en,
+  },
+  hi: {
+    ...india,
+  },
+  "zh-TW": {
+    ...tw,
+  },
+  th: {
+    ...ty,
+  },
+  ja: {
+    ...ry,
+  },
+  ko: {
+    ...hy,
+  },
 };
 // en-us  zh-cn
-//let langLocale = getCookie(LOCALE_KEY) || 'en';
+// let langLocale = getCookie(LOCALE_KEY) || 'en';
 if (!window.localStorage.getItem(LOCALE_KEY)) {
   window.localStorage.setItem(LOCALE_KEY, DEFAULT_LANG);
 }
 let langLocale = window.localStorage.getItem(LOCALE_KEY)
   ? window.localStorage.getItem(LOCALE_KEY)
-  : "zh";
+  : "zh-CN";
 const i18n = new VueI18n({
   locale: langLocale,
   messages: locales,
-  silentTranslationWarn: true
+  silentTranslationWarn: true,
 });
 const init = Vue.prototype._init;
-Vue.prototype._init = function(options) {
+Vue.prototype._init = function (options) {
   init.call(this, {
     i18n,
-    ...options
+    ...options,
   });
 };
 
-export const setup = lang => {
+export const setup = (lang) => {
   if (lang === undefined) {
     // lang = window.localStorage.getItem(LOCALE_KEY);
-    //const language = getCookie(LOCALE_KEY);
+    // const language = getCookie(LOCALE_KEY);
     const language = window.localStorage.getItem(LOCALE_KEY);
     if (language) {
       langLocale = language.replace("-", "_").toLowerCase();

--
Gitblit v1.9.3