Merge branch 'master' of github.com:MCSManager/MCSManager

This commit is contained in:
Unitwk 2024-04-01 20:04:43 +08:00
commit daf2bbd6b4
6 changed files with 1880 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import i18next from "i18next";
import zh_cn from "@languages/zh_CN.json";
import en_us from "@languages/en_US.json";
import zh_tw from "@languages/zh_TW.json";
i18next.init({
interpolation: {
@ -15,7 +16,10 @@ i18next.init({
},
en_us: {
translation: en_us
}
},
zh_tw: {
translation: zh_tw
},
}
});

View File

@ -2,6 +2,7 @@ import { createI18n } from "vue-i18n";
import enUS from "@languages/en_US.json";
import zhCN from "@languages/zh_CN.json";
import zhTW from "@languages/zh_TW.json";
import { updateSettings } from "@/services/apis";
export const LANGUAGE_KEY = "LANGUAGE";
@ -32,7 +33,8 @@ function initI18n(lang: string) {
fallbackLocale: toStandardLang("en_us"),
messages: {
en_us: enUS,
zh_cn: zhCN
zh_cn: zhCN,
zh_tw: zhTW
}
});
}
@ -59,6 +61,10 @@ const isEN = () => {
return getCurrentLang() === "en_us";
};
const isTW = () => {
return getCurrentLang() === "zh_tw";
}
const $t = (...args: string[]): string => {
return (i18n.global.t as Function)(...args);
};
@ -68,4 +74,4 @@ const t = (...args: string[]): string => {
(window as any).setLang = setLanguage;
export { setLanguage, getCurrentLang, $t, t, initI18n, isCN, isEN };
export { setLanguage, getCurrentLang, $t, t, initI18n, isCN, isEN, isTW };

View File

@ -89,6 +89,10 @@ const allLanguages = [
{
label: "English",
value: "en_us"
},
{
label: "繁體中文",
value: "zh_tw"
}
];

View File

@ -2,7 +2,7 @@ const fs = require("fs");
const { crc32 } = require("crc");
const FN_KEY = "TXT_CODE_";
const LANGUAGES = ["zh_CN", "en_US"];
const LANGUAGES = ["zh_CN", "en_US", "zh_TW"];
module.exports = {
input: ["./**/*.{ts,vue}", "!**/node_modules/**"],

1858
languages/zh_TW.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@ import i18next from "i18next";
import zh_cn from "@languages/zh_CN.json";
import en_us from "@languages/en_US.json";
import zh_tw from "@languages/zh_TW.json";
i18next.init({
interpolation: {
@ -15,6 +16,9 @@ i18next.init({
},
en_us: {
translation: en_us
},
zh_tw: {
translation: zh_tw
}
}
});