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