From 44db498cedee7573d090797b1fe5c331c413b00a Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Mon, 22 Apr 2024 19:03:57 +0800
Subject: [PATCH] first
---
src/locales/index.js | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/locales/index.js b/src/locales/index.js
index baf53dc..8145337 100644
--- a/src/locales/index.js
+++ b/src/locales/index.js
@@ -2,35 +2,43 @@
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 ty from "@/locales/th.json";
import ry from "@/locales/jp.json";
import hy from "@/locales/kor.json";
+import de from "@/locales/de.json";
+import fra from "@/locales/fra.json";
Vue.use(VueI18n);
-const DEFAULT_LANG = "zh-CN";
+const DEFAULT_LANG = window.localStorage.getItem("language") || "hi";
const LOCALE_KEY = "language";
-
+window.localStorage.setItem("language", DEFAULT_LANG);
const locales = {
en: {
- ...en,
+ ...en
},
hi: {
- ...india,
+ ...india
},
- "zh-TW": {
- ...tw,
+ zh: {
+ ...zh
},
th: {
- ...ty,
+ ...ty
+ },
+ fra: {
+ ...fra
+ },
+ de: {
+ ...de
},
ja: {
- ...ry,
+ ...ry
},
ko: {
- ...hy,
- },
+ ...hy
+ }
};
// en-us zh-cn
// let langLocale = getCookie(LOCALE_KEY) || 'en';
@@ -43,17 +51,17 @@
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