Commit 2aac735f authored by BBeretta's avatar BBeretta

feat/language-translation (MD Pro Page translation)

parent e6670a75
Pipeline #27833 failed with stages
in 8 minutes and 16 seconds
......@@ -15,6 +15,7 @@ import { setSelectedDeck } from "../..";
import { editDeckStore } from "../../store";
import { iDeckToEditingDeck } from "../../utils";
import styles from "./index.module.scss";
import { useTranslation } from "react-i18next";
const { assetsPath } = useConfig();
......@@ -41,7 +42,7 @@ const store = proxy<Props>({
export const DeckResults: React.FC = memo(() => {
const snap = useSnapshot(store);
const { message } = App.useApp();
const { t: i18n } = useTranslation("DeckResults");
useEffect(() => {
if (snap.onlyMine) {
// show only decks uploaded by myself
......@@ -116,7 +117,7 @@ export const DeckResults: React.FC = memo(() => {
) : (
<div className={styles.empty}>
<IconFont type="icon-empty" size={40} />
<div>找不到相应卡组</div>
<div>{ i18n("NoDeckGroupFound") }</div>
</div>
)}
</>
......
......@@ -146,7 +146,7 @@ export const DeckDatabase: React.FC = () => {
icon={<SwapOutlined />}
onClick={() => setShowMdproDecks(!showMdproDecks)}
>
{showMdproDecks ? "卡片数据库" : "Mdpro在线卡组"}
{showMdproDecks ? i18n("CardDatabase") : i18n("MDProOnlineDeck")}
</Button>
</Space>
<div className={styles["select-btns"]}>
......@@ -156,8 +156,8 @@ export const DeckDatabase: React.FC = () => {
style={{ width: "18.90rem" }}
defaultValue={false}
options={[
{ value: true, label: "只显示我上传的卡组" },
{ value: false, label: "显示全部在线卡组" },
{ value: true, label: i18n("OnlyShowDecksIUploaded") },
{ value: false, label: i18n("ShowAllOnlineDecks") },
]}
onChange={
// @ts-ignore
......
......@@ -62,7 +62,12 @@
"PendulumScaleFromHighToLow": "灵摆刻度从高到低",
"PendulumScaleFromLowToHigh": "灵摆刻度从低到高",
"ResetSuccessful": "重置成功",
"SaveSuccessful": "保存成功"
"SaveSuccessful": "保存成功",
"NoDeckGroupFound": "找不到相应卡组",
"OnlyShowDecksIUploaded": "只显示我上传的卡组",
"ShowAllOnlineDecks": "显示全部在线卡组",
"CardDatabase": "卡片数据库",
"MDProOnlineDeck": "Mdpro在线卡组"
},
"Filter": {
"CardFilter": "卡片筛选",
......
......@@ -62,7 +62,12 @@
"PendulumScaleFromHighToLow": "Pendulum Scale from high to low",
"PendulumScaleFromLowToHigh": "Pendulum Scale from low to high",
"ResetSuccessful": "Reset successful",
"SaveSuccessful": "Save successful"
"SaveSuccessful": "Save successful",
"NoDeckGroupFound": "No corresponding Deck group found",
"OnlyShowDecksIUploaded": "Only show decks I uploaded",
"ShowAllOnlineDecks": "Show all online decks",
"CardDatabase": "Card Database",
"MDProOnlineDeck": "MDPro Online Deck"
},
"Filter": {
"CardFilter": "Card Filter",
......
......@@ -86,7 +86,7 @@ const resources = {
i18next.use(initReactI18next).init({
resources,
lng: "cn", //default language
lng: localStorage.getItem("language") ? localStorage.getItem("language")?.toString() : "cn", //default language
});
export default i18next;
......@@ -109,7 +109,6 @@ export const Component = () => {
</HeaderBtn>
<span style={{ flexGrow: 1 }} />
<span className={styles.profile}>
{location.pathname === "/" && <I18NSelector />}
<Dropdown
arrow
menu={{
......
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