Commit 8f1aa9a7 authored by BBeretta's avatar BBeretta

feat/language-translation (dev solution provided by ChunChi )

parent 677e08f2
Pipeline #27842 failed with stages
in 7 minutes and 33 seconds
......@@ -86,22 +86,27 @@ export function getCardImgUrl(code: number, back = false) {
return `${ASSETS_BASE}/card_back.jpg`;
}
// Define translations for different languages (I18N)
const language = localStorage.getItem("language");
let imgUrl;
switch (language) {
case "en":
case "br":
case "pt":
case "fr":
case "es":
imgUrl = NeosConfig.releaseImgUrl.replace("zh-CN", "en-US");
break;
default:
imgUrl = NeosConfig.releaseImgUrl;
break;
}
/* End of definition (I18N) */
if (isSuperReleaseCard(code)) {
return `${NeosConfig.preReleaseImgUrl}/${code}.jpg`;
} else {
const language = localStorage.getItem("language");
if (
language === "en" ||
language === "br" ||
language === "pt" ||
language === "fr" ||
language === "es"
) {
NeosConfig.releaseImgUrl = NeosConfig.releaseImgUrl.replace(
"zh-CN",
"en-US",
);
}
return `${NeosConfig.releaseImgUrl}/${code}.jpg`;
return `${imgUrl}/${code}.jpg`;
}
}
......@@ -9,21 +9,27 @@ export async function initStrings() {
const language = localStorage.getItem("language") || "cn";
//It currently only supports en-US, es-ES, ja-JP, ko-KR, zh-CN
if (
language === "en" ||
language === "br" ||
language === "pt" ||
language === "fr"
) {
switch (language) {
case "en":
case "br":
case "pt":
case "fr":
stringsUrl = stringsUrl.replace("zh-CN", "en-US");
} else if (language === "ja") {
break;
case "ja":
stringsUrl = stringsUrl.replace("zh-CN", "ja-JP");
} else if (language === "es") {
break;
case "es":
stringsUrl = stringsUrl.replace("zh-CN", "es-ES");
} else if (language === "ko") {
break;
case "ko":
stringsUrl = stringsUrl.replace("zh-CN", "ko-KR");
break;
default:
break;
}
const strings = await (await fetch(stringsUrl)).text();
const lineIter = strings.split("\n");
......
......@@ -62,6 +62,24 @@ interface YgoDbs {
let YGODBS: YgoDbs = { release: null, preRelease: null };
//It currently only supports en-US, es-ES, ja-JP, ko-KR, zh-CN
// Function to update URLs based on the language
function updateDbUrls(info: any, language: string): void {
const languageMap: { [key: string]: string } = {
en: "en-US",
br: "en-US",
pt: "en-US",
fr: "en-US",
ja: "ja-JP",
ko: "ko-KR",
es: "es-ES",
};
const locale = languageMap[language] || "zh-CN";
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", locale);
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", locale);
}
// FIXME: 应该有个返回值,告诉业务方本次请求的结果,比如初始化DB失败
function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
switch (action.cmd) {
......@@ -69,25 +87,8 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
const info = action.initInfo;
if (info) {
const language = localStorage.getItem("language") || "cn";
//It currently only supports en-US, es-ES, ja-JP, ko-KR, zh-CN
if (
language === "en" ||
language === "br" ||
language === "pt" ||
language === "fr"
) {
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", "en-US");
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", "en-US");
} else if (language === "ja") {
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", "ja-JP");
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", "ja-JP");
} else if (language === "ko") {
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", "ko-KR");
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", "ko-KR");
} else if (language === "es") {
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", "es-ES");
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", "es-ES");
}
// Update URLs based on the language
updateDbUrls(info, language);
const releasePromise = pfetch(info.releaseDbUrl, {
progressCallback: action.initInfo?.progressCallback,
......
......@@ -15,15 +15,58 @@ const DECKERROR_EXTRACOUNT = 0x7;
const DECKERROR_SIDECOUNT = 0x8;
const DECKERROR_NOTAVAIL = 0x9;
const language = localStorage.getItem("language");
const mainDeckWarining =
language !== "cn"
? "The main deck should contain 40-60 cards."
: "主卡组数量应为40-60张";
// Define the possible language codes (I18N)
type Language = "en" | "br" | "pt" | "fr" | "ja" | "ko" | "es" | "cn";
// Define the structure for the messages (I18N)
const messages: Record<
Language,
{ mainDeckWarning: string; extraDeckWarning: string }
> = {
en: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
br: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
pt: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
fr: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
ja: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
ko: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
es: {
mainDeckWarning: "The number of Main Deck should be 40-60 cards",
extraDeckWarning: "The number of Extra Deck should be 0-15",
},
cn: {
mainDeckWarning: "主卡组数量应为40-60张",
extraDeckWarning: "额外卡组数量应为0-15张",
},
};
/* End of definition (I18N) */
export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
const { error_type, error_code } = errorMsg;
playEffect(AudioActionType.SOUND_INFO);
// Get the language from localStorage or default to 'cn' (I18N)
const language = (localStorage.getItem("language") || "cn") as Language;
const mainDeckWarning = messages[language].mainDeckWarning;
//const extraDeckWarning = messages[language].extraDeckWarning;
switch (error_type) {
case ErrorType.JOINERROR: {
roomStore.errorMsg = fetchStrings(Region.System, 1403 + error_code);
......@@ -63,7 +106,7 @@ export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
break;
}
case DECKERROR_MAINCOUNT: {
roomStore.errorMsg = mainDeckWarining;
roomStore.errorMsg = mainDeckWarning;
break;
}
case DECKERROR_EXTRACOUNT: {
......
......@@ -7,17 +7,80 @@ import { Type } from "@/ui/Shared/DeckZone";
import { compareCards, type EditingDeck } from "./utils";
const language = localStorage.getItem("language");
const cardTypeNotMatch =
language !== "cn" ? "The Card Type does not match" : "卡片种类不符合";
const exceedsNumberCardsSameName =
language !== "cn"
? "Exceeds the number of cards with the same name"
: "超过同名卡";
const limitCards = language !== "cn" ? "Limit of cards" : "张的上限";
const exceedsLimit = language !== "cn" ? "Exceeds the limit" : "超过";
const cannotAddTokens =
language !== "cn" ? "Cannot add tokens" : "不能添加衍生物";
// Define the possible language codes (I18N)
type Language = "en" | "br" | "pt" | "fr" | "ja" | "ko" | "es" | "cn";
// Define the structure for the messages (I18N)
const messages: Record<
Language,
{ cardTypeNotMatch: string; exceedsNumberCardsSameName: string, limitCards: string, exceedsLimit: string, cannotAddTokens: string }
> = {
en: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
br: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
pt: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
fr: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
ja: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
ko: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "The number of Extra Deck should be 0-15",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
es: {
cardTypeNotMatch: "The Card Type does not match",
exceedsNumberCardsSameName: "Exceeds the number of cards with the same name",
limitCards: "Limit of cards",
exceedsLimit: "Exceeds the limit",
cannotAddTokens: "Cannot add tokens"
},
cn: {
cardTypeNotMatch: "卡片种类不符合",
exceedsNumberCardsSameName: "超过同名卡",
limitCards: "张的上限",
exceedsLimit: "超过",
cannotAddTokens: "不能添加衍生物"
},
};
// Get the language from localStorage or default to 'cn' (I18N)
const language = (localStorage.getItem("language") || "cn") as Language;
const cardTypeNotMatch = messages[language].cardTypeNotMatch;
const exceedsNumberCardsSameName = messages[language].exceedsNumberCardsSameName;
const limitCards = messages[language].limitCards;
const exceedsLimit = messages[language].exceedsLimit;
const cannotAddTokens = messages[language].cannotAddTokens;
/* End of definition (I18N) */
export const editDeckStore = proxy({
deckName: "",
......
......@@ -16,9 +16,83 @@ const defaultProps = { isOpen: false, positions: [] };
const localStore = proxy<PositionModalProps>(defaultProps);
const language = localStorage.getItem("language");
const title = language !== "cn" ? "Please select a position" : "请选择表示形式";
// Define a type for translations with an index signature (I18N)
interface Translations {
[key: string]: {
Title: string,
FACEUP_ATTACK: string;
FACEUP_DEFENSE: string;
FACEDOWN_ATTACK: string;
FACEDOWN_DEFENSE: string;
};
}
// Retrieve language from localStorage or default to "cn"
const language = localStorage.getItem("language") || "cn";
// Define translations for different languages (I18N)
const translations: Translations = {
en: {
Title: "Please select a position",
FACEUP_ATTACK: "Face-Up Attack",
FACEUP_DEFENSE: "Face-Up Defense",
FACEDOWN_ATTACK: "Face-Down Attack",
FACEDOWN_DEFENSE: "Face-Down Defense",
},
br: {
Title: "Por favor, selecione uma posição",
FACEUP_ATTACK: "Ataque com a Face para Cima",
FACEUP_DEFENSE: "Defesa com a Face para Cima",
FACEDOWN_ATTACK: "Ataque com a Face para Baixo",
FACEDOWN_DEFENSE: "Defesa com a Face para Baixo",
},
pt: {
Title: "Por favor, selecione uma posição",
FACEUP_ATTACK: "Ataque com a Face para Cima",
FACEUP_DEFENSE: "Defesa com a Face para Cima",
FACEDOWN_ATTACK: "Ataque com a Face para Baixo",
FACEDOWN_DEFENSE: "Defesa com a Face para Baixo",
},
fr: {
Title: "Veuillez sélectionner une position",
FACEUP_ATTACK: "Attaque Face Visible",
FACEUP_DEFENSE: "Défense Face Visible",
FACEDOWN_ATTACK: "Attaque Face Cachée",
FACEDOWN_DEFENSE: "Défense Face Cachée",
},
ja: {
Title: "ポジションを選択してください",
FACEUP_ATTACK: "表側攻撃表示",
FACEUP_DEFENSE: "表側守備表示",
FACEDOWN_ATTACK: "裏側攻撃表示",
FACEDOWN_DEFENSE: "裏側守備表示",
},
ko: {
Title: "포지션을 선택해주세요",
FACEUP_ATTACK: "앞면 공격 표시",
FACEUP_DEFENSE: "앞면 수비 표시",
FACEDOWN_ATTACK: "뒷면 공격 표시",
FACEDOWN_DEFENSE: "뒷면 수비 표시",
},
es: {
Title: "Por favor, seleccione una posición",
FACEUP_ATTACK: "Ataque en Posición de Ataque",
FACEUP_DEFENSE: "Defensa en Posición de Ataque",
FACEDOWN_ATTACK: "Ataque en Posición de Defensa",
FACEDOWN_DEFENSE: "Defensa en Posición de Defensa",
},
cn: {
Title: "请选择表示形式",
FACEUP_ATTACK: "正面攻击形式",
FACEUP_DEFENSE: "正面防守形式",
FACEDOWN_ATTACK: "背面攻击形式",
FACEDOWN_DEFENSE: "背面防守形式",
},
};
// // Define translations for different languages (I18N)
// const title = language !== "cn" ? "Please select a position" : "请选择表示形式";
// const test = translations[language].Title
export const PositionModal = () => {
const { isOpen, positions } = useSnapshot(localStore);
const [selected, setSelected] = useState<ygopro.CardPosition | undefined>(
......@@ -27,7 +101,7 @@ export const PositionModal = () => {
return (
<NeosModal
title={title}
title={translations[language].Title}
open={isOpen}
footer={
<Button
......@@ -63,24 +137,22 @@ export const PositionModal = () => {
);
};
// Function to get card position based on language
function cardPosition(position: ygopro.CardPosition): string {
const faceUpAtk = language !== "cn" ? "Face-Up Attack" : "正面攻击形式";
const faceUpDef = language !== "cn" ? "Face-Up Defense" : "正面防守形式";
const faceDownAtk = language !== "cn" ? "Face-Down Attack" : "背面攻击形式";
const faceDownDef = language !== "cn" ? "Face-Down Defense" : "背面防守形式";
const messages = translations[language];
switch (position) {
case ygopro.CardPosition.FACEUP_ATTACK: {
return faceUpAtk;
return messages.FACEUP_ATTACK;;
}
case ygopro.CardPosition.FACEUP_DEFENSE: {
return faceUpDef;
return messages.FACEUP_DEFENSE;
}
case ygopro.CardPosition.FACEDOWN_ATTACK: {
return faceDownAtk;
return messages.FACEDOWN_ATTACK;;
}
case ygopro.CardPosition.FACEDOWN_DEFENSE: {
return faceDownDef;
return messages.FACEDOWN_DEFENSE;
}
default: {
return "[?]";
......
......@@ -39,22 +39,137 @@ import { openChatBox } from "../ChatBox";
const { useToken } = theme;
const FINISH_CANCEL_RESPONSE = -1;
const language = localStorage.getItem("language");
const drawPhase = language !== "cn" ? "Draw" : "抽卡阶段";
const standbyPhase = language !== "cn" ? "Standhy Phase" : "准备阶段";
const mainPhase1 = language !== "cn" ? "Main Phase 1" : "主要阶段 1";
const battlePhase = language !== "cn" ? "Battle Phase" : "战斗阶段";
const battleStart = language !== "cn" ? "Battle Start" : "战斗开始";
const battleStep = language !== "cn" ? "Battle Step" : "战斗步骤";
const damage = language !== "cn" ? "Damage Step" : "伤害步骤";
const damageCalc =
language !== "cn"
? "Damage Step (Damage Calculation)"
: "伤害步骤(伤害计算)";
const mainPhase2 = language !== "cn" ? "Main Phase 2" : "主要阶段 2";
const endPhase = language !== "cn" ? "End Phase" : "结束阶段";
const unknown = language !== "cn" ? "Unknown" : "未知阶段";
// Define the possible language codes (I18N)
type Language = "en" | "br" | "pt" | "fr" | "ja" | "ko" | "es" | "cn";
// Define the structure for the messages (I18N)
const messages: Record<
Language,
{
drawPhase: string; standbyPhase: string, mainPhase1: string, battlePhase: string, battleStart: string, battleStep: string, damage: string, damageCalc: string, mainPhase2: string, endPhase: string, unknown: string
}
> = {
en: {
drawPhase: "Draw",
standbyPhase: "Standhy Phase",
mainPhase1: "Main Phase 1",
battlePhase: "Battle Phase",
battleStart: "Battle Start",
battleStep: "Battle Step",
damage: "Damage Step",
damageCalc: "Damage Step (Damage Calculation)",
mainPhase2: "Main Phase 2",
endPhase: "End Phase",
unknown: "Unknown"
},
br: {
drawPhase: "Compra",
standbyPhase: "Fase de Espera",
mainPhase1: "Fase Principal 1",
battlePhase: "Fase de Batalha",
battleStart: "Início da Batalha",
battleStep: "Fase da Batalha",
damage: "Fase de Dano",
damageCalc: "Fase de Dano (Cálculo de Dano)",
mainPhase2: "Fase Principal 2",
endPhase: "Fase Final",
unknown: "Desconhecido"
},
pt: {
drawPhase: "Compra",
standbyPhase: "Fase de Espera",
mainPhase1: "Fase Principal 1",
battlePhase: "Fase de Batalha",
battleStart: "Início da Batalha",
battleStep: "Fase da Batalha",
damage: "Fase de Dano",
damageCalc: "Fase de Dano (Cálculo de Dano)",
mainPhase2: "Fase Principal 2",
endPhase: "Fase Final",
unknown: "Desconhecido"
},
fr: {
drawPhase: "Pioche",
standbyPhase: "Phase de Standby",
mainPhase1: "Phase Principale 1",
battlePhase: "Phase de Bataille",
battleStart: "Début de la Bataille",
battleStep: "Étape de Bataille",
damage: "Étape de Dégâts",
damageCalc: "Étape de Dégâts (Calcul des Dégâts)",
mainPhase2: "Phase Principale 2",
endPhase: "Phase Finale",
unknown: "Inconnu"
},
ja: {
drawPhase: "ドロー",
standbyPhase: "スタンバイフェイズ",
mainPhase1: "メインフェイズ 1",
battlePhase: "バトルフェイズ",
battleStart: "バトル開始",
battleStep: "バトルステップ",
damage: "ダメージステップ",
damageCalc: "ダメージステップ(ダメージ計算)",
mainPhase2: "メインフェイズ 2",
endPhase: "エンドフェイズ",
unknown: "未知"
},
ko: {
drawPhase: "드로우",
standbyPhase: "대기 페이즈",
mainPhase1: "메인 페이즈 1",
battlePhase: "배틀 페이즈",
battleStart: "배틀 시작",
battleStep: "배틀 스텝",
damage: "데미지 스텝",
damageCalc: "데미지 스텝 (데미지 계산)",
mainPhase2: "메인 페이즈 2",
endPhase: "엔드 페이즈",
unknown: "알 수 없음"
},
es: {
drawPhase: "Robo",
standbyPhase: "Fase de Espera",
mainPhase1: "Fase Principal 1",
battlePhase: "Fase de Batalla",
battleStart: "Inicio de Batalla",
battleStep: "Paso de Batalla",
damage: "Paso de Daño",
damageCalc: "Paso de Daño (Cálculo de Daño)",
mainPhase2: "Fase Principal 2",
endPhase: "Fase Final",
unknown: "Desconocido"
},
cn: {
drawPhase: "抽卡阶段",
standbyPhase: "准备阶段",
mainPhase1: "主要阶段 1",
battlePhase: "战斗阶段",
battleStart: "战斗开始",
battleStep: "战斗步骤",
damage: "伤害步骤",
damageCalc: "伤害步骤(伤害计算)",
mainPhase2: "主要阶段 2",
endPhase: "结束阶段",
unknown: "未知阶段",
},
};
// Get the language from localStorage or default to 'cn' (I18N)
const language = (localStorage.getItem("language") || "cn") as Language;
const drawPhase = messages[language].drawPhase;
const standbyPhase = messages[language].standbyPhase;
const mainPhase1 = messages[language].mainPhase1;
const battlePhase = messages[language].battlePhase;
const battleStart = messages[language].battleStart;
const battleStep = messages[language].battleStep;
const damage = messages[language].damage;
const damageCalc = messages[language].damageCalc;
const mainPhase2 = messages[language].mainPhase2;
const endPhase = messages[language].endPhase;
const unknown = messages[language].unknown;
/* End of definition (I18N) */
// PhaseType, 中文, response, 是否显示,是否禁用
const initialPhaseBind: [
......@@ -75,7 +190,7 @@ const initialPhaseBind: [
[PhaseType.MAIN2, mainPhase2, 2, true, false],
[PhaseType.END, endPhase, 7, true, false],
[PhaseType.UNKNOWN, unknown, -1, false, true],
];
];
export const Menu = () => {
const { t: i18n } = useTranslation("Menu");
......
......@@ -4,16 +4,102 @@ import { IconFont } from "@/ui/Shared";
import CardPosition = ygopro.CardPosition;
const language = localStorage.getItem("language");
// Define the possible language codes (I18N)
type Language = "en" | "br" | "pt" | "fr" | "ja" | "ko" | "es" | "cn";
// Define the structure for the messages (I18N)
const messages: Record<
Language,
{
sSet: string; summon: string, spSummon: string, posChange: string, mSet: string, activate: string, attack: string
}
> = {
en: {
sSet: "Set",
summon: "Normal Summon",
spSummon: "Special Summon",
posChange: "Change Position",
mSet: "Set",
activate: "Activate",
attack: "Attack"
},
br: {
sSet: "Setar",
summon: "Invocação Normal",
spSummon: "Invocação Especial",
posChange: "Mudar Posição",
mSet: "Setar",
activate: "Ativar",
attack: "Atacar"
},
pt: {
sSet: "Setar",
summon: "Invocação Normal",
spSummon: "Invocação Especial",
posChange: "Mudar Posição",
mSet: "Setar",
activate: "Ativar",
attack: "Atacar"
},
fr: {
sSet: "Poser",
summon: "Invocation Normale",
spSummon: "Invocation Spéciale",
posChange: "Changer de Position",
mSet: "Poser",
activate: "Activer",
attack: "Attaquer"
},
ja: {
sSet: "セット",
summon: "通常召喚",
spSummon: "特殊召喚",
posChange: "表示形式変更",
mSet: "セット",
activate: "発動",
attack: "攻撃"
},
ko: {
sSet: "세트",
summon: "일반 소환",
spSummon: "특수 소환",
posChange: "포지션 변경",
mSet: "세트",
activate: "발동",
attack: "공격"
},
es: {
sSet: "Colocar",
summon: "Invocación Normal",
spSummon: "Invocación Especial",
posChange: "Cambiar Posición",
mSet: "Colocar",
activate: "Activar",
attack: "Atacar"
},
cn: {
sSet: "后场放置",
summon: "普通召唤",
spSummon: "特殊召唤",
posChange: "改变表示形式",
mSet: "前场放置",
activate: "发动效果",
attack: "攻击",
},
};
// Get the language from localStorage or default to 'cn' (I18N)
const language = (localStorage.getItem("language") || "cn") as Language;
/* End of definition (I18N) */
export function interactTypeToString(t: InteractType): string {
const sSet = language !== "cn" ? "Set" : "后场放置";
const summon = language !== "cn" ? "Normal Summon" : "普通召唤";
const spSummon = language !== "cn" ? "Special Summon" : "特殊召唤";
const posChange = language !== "cn" ? "Change Position" : "改变表示形式";
const mSet = language !== "cn" ? "Set" : "前场放置";
const activate = language !== "cn" ? "Activate" : "发动效果";
const attack = language !== "cn" ? "Attack" : "攻击";
const sSet = messages[language].sSet;
const summon = messages[language].summon;
const spSummon = messages[language].spSummon;
const posChange = messages[language].posChange;
const mSet = messages[language].mSet;
const activate = messages[language].activate;
const attack = messages[language].attack;
switch (t) {
case InteractType.SUMMON:
......
......@@ -86,9 +86,7 @@ const resources = {
i18next.use(initReactI18next).init({
resources,
lng: localStorage.getItem("language")
? localStorage.getItem("language")?.toString()
: "cn", //default language
lng: localStorage.getItem("language") ?? "cn", //default language
});
export default i18next;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment