Commit 3ed6bdd4 authored by BBeretta's avatar BBeretta

feat/language-translation (prettier fixes)

parent 5390fb5e
Pipeline #27823 passed with stages
in 9 minutes and 15 seconds
......@@ -69,7 +69,6 @@ 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" ||
......@@ -82,12 +81,12 @@ function helper<T extends sqliteCmd>(action: sqliteAction<T>) {
} 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 === "es") {
info.releaseDbUrl = info.releaseDbUrl.replace("zh-CN", "es-ES");
info.preReleaseDbUrl = info.preReleaseDbUrl.replace("zh-CN", "es-ES");
} 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");
}
const releasePromise = pfetch(info.releaseDbUrl, {
......
......@@ -16,7 +16,7 @@ const DECKERROR_NOTAVAIL = 0x9;
const language = localStorage.getItem("language");
const mainDeckWarining =
language != "cn"
language !== "cn"
? "The main deck should contain 40-60 cards."
: "主卡组数量应为40-60张";
......
import { Button, Descriptions, type DescriptionsProps } from "antd";
import classNames from "classnames";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { type CardMeta, fetchCard, fetchStrings, Region } from "@/api";
import {
......@@ -15,7 +16,6 @@ import {
import { CardEffectText, IconFont, ScrollableArea, YgoCard } from "@/ui/Shared";
import styles from "./CardDetail.module.scss";
import { useTranslation } from "react-i18next";
export const CardDetail: React.FC<{
code: number;
......
......@@ -14,8 +14,8 @@ 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 limitCards = language !== "cn" ? "Limit of cards" : "张的上限";
const exceedsLimit = language !== "cn" ? "Exceeds the limit" : "超过";
const cannotAddTokens =
language !== "cn" ? "Cannot add tokens" : "不能添加衍生物";
......
......@@ -16,8 +16,8 @@ const defaultProps = { isOpen: false, positions: [] };
const localStore = proxy<PositionModalProps>(defaultProps);
const language = localStorage.getItem('language');
const title = language != 'cn' ? 'Please select a position' : '请选择表示形式';
const language = localStorage.getItem("language");
const title = language != "cn" ? "Please select a position" : "请选择表示形式";
export const PositionModal = () => {
const { isOpen, positions } = useSnapshot(localStore);
......@@ -25,7 +25,6 @@ export const PositionModal = () => {
undefined,
);
return (
<NeosModal
title={title}
......@@ -65,10 +64,10 @@ export const PositionModal = () => {
};
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 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" : "背面防守形式";
switch (position) {
case ygopro.CardPosition.FACEUP_ATTACK: {
......
......@@ -110,7 +110,9 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
<>
<span>{preHintMsg}</span>
<span>{selectHintMsg}</span>
<span>({i18n("PleaseSelect")} {minMaxText} {i18n("Cards")})</span>
<span>
({i18n("PleaseSelect")} {minMaxText} {i18n("Cards")})
</span>
<span>{single ? i18n("SelectOneCardAtTime") : ""}</span>
</>
} // TODO: 这里可以再细化一些
......
......@@ -140,9 +140,9 @@ export const Menu = () => {
setPhaseSwitchItems(newPhaseSwitchItems);
}, [phaseBind]);
const allChain = language != "cn" ? "All Chain" : "";
const ignoreChain = language != "cn" ? "Ignore Chain" : "";
const smartChain = language != "cn" ? "Smart Chain" : "";
const allChain = language !== "cn" ? "All Chain" : "";
const ignoreChain = language !== "cn" ? "Ignore Chain" : "";
const smartChain = language !== "cn" ? "Smart Chain" : "";
const chainSettingTexts = [
[ChainSetting.CHAIN_ALL, allChain],
......
......@@ -4,16 +4,16 @@ import { IconFont } from "@/ui/Shared";
import CardPosition = ygopro.CardPosition;
const language = localStorage.getItem('language');
const language = localStorage.getItem("language");
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 = 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" : "攻击";
switch (t) {
case InteractType.SUMMON:
......
......@@ -2,6 +2,7 @@ import { CopyOutlined, KeyOutlined } from "@ant-design/icons";
import type { CheckboxProps } from "antd";
import { App, Button, Checkbox, Input } from "antd";
import React, { ChangeEvent, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { proxy, useSnapshot } from "valtio";
import { defaultOptions, getPrivateRoomID, Options } from "@/api";
......@@ -9,7 +10,6 @@ import { accountStore } from "@/stores";
import { Select } from "@/ui/Shared";
import styles from "./index.module.scss";
import { useTranslation } from "react-i18next";
interface CustomRoomProps {
options: Options;
......
......@@ -71,7 +71,8 @@ export function getCardImgUrl(code: number, back = false) {
language === "en" ||
language === "br" ||
language === "pt" ||
language === "fr"
language === "fr" ||
language === "es"
) {
NeosConfig.releaseImgUrl = NeosConfig.releaseImgUrl.replace(
"zh-CN",
......
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