From 732c30b33f782c2d2ebb62eacda2fb7a453a7ecd Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Sat, 31 Jan 2026 11:01:45 +0800
Subject: [PATCH] 1
---
src/locales/index.js | 51 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/src/locales/index.js b/src/locales/index.js
index baf53dc..d60337c 100644
--- a/src/locales/index.js
+++ b/src/locales/index.js
@@ -2,35 +2,54 @@
import VueI18n from "vue-i18n";
import en from "./en.json";
import india from "@/locales/hi.json";
-import tw from "@/locales/cht.json";
+import zh from "@/locales/zh.json";
+import cht from "@/locales/cht.json";
import ty from "@/locales/th.json";
-import ry from "@/locales/jp.json";
+import jp from "@/locales/jp.json";
import hy from "@/locales/kor.json";
+import de from "@/locales/de.json";
+import fra from "@/locales/fra.json";
+import es from "@/locales/es.json";
Vue.use(VueI18n);
-const DEFAULT_LANG = "zh-CN";
+const DEFAULT_LANG = window.localStorage.getItem("language") || "jp";
const LOCALE_KEY = "language";
-
+window.localStorage.setItem("language", DEFAULT_LANG);
const locales = {
en: {
- ...en,
+ ...en
},
hi: {
- ...india,
+ ...india
},
- "zh-TW": {
- ...tw,
+ "zh-CN": {
+ ...zh
+ },
+ "zh-Hant": {
+ ...cht
},
th: {
- ...ty,
+ ...ty
+ },
+ fr: {
+ ...fra
+ },
+ de: {
+ ...de
},
ja: {
- ...ry,
+ ...jp
+ },
+ jp: {
+ ...jp
},
ko: {
- ...hy,
+ ...hy
},
+ es: {
+ ...es
+ }
};
// en-us zh-cn
// let langLocale = getCookie(LOCALE_KEY) || 'en';
@@ -39,21 +58,21 @@
}
let langLocale = window.localStorage.getItem(LOCALE_KEY)
? window.localStorage.getItem(LOCALE_KEY)
- : "zh-CN";
+ : "jp";
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);
--
Gitblit v1.9.3