Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
6aafbde0
Commit
6aafbde0
authored
May 30, 2024
by
BBeretta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat/language-translation (Deck Select, Build Deck, Store)
parent
12916da4
Pipeline
#27382
failed with stages
in 7 minutes and 23 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
26 deletions
+50
-26
src/ui/BuildDeck/DeckSelect.tsx
src/ui/BuildDeck/DeckSelect.tsx
+10
-7
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+3
-3
src/ui/BuildDeck/store.ts
src/ui/BuildDeck/store.ts
+10
-5
src/ui/I18N/Source/Chinese/translation.json
src/ui/I18N/Source/Chinese/translation.json
+12
-4
src/ui/I18N/Source/English/translation.json
src/ui/I18N/Source/English/translation.json
+12
-4
src/ui/I18N/index.ts
src/ui/I18N/index.ts
+3
-3
No files found.
src/ui/BuildDeck/DeckSelect.tsx
View file @
6aafbde0
...
@@ -13,6 +13,7 @@ import { deckStore, IDeck } from "@/stores";
...
@@ -13,6 +13,7 @@ import { deckStore, IDeck } from "@/stores";
import
{
Uploader
}
from
"
../Shared
"
;
import
{
Uploader
}
from
"
../Shared
"
;
import
styles
from
"
./DeckSelect.module.scss
"
;
import
styles
from
"
./DeckSelect.module.scss
"
;
import
{
useTranslation
}
from
"
react-i18next
"
;
export
const
DeckSelect
:
React
.
FC
<
{
export
const
DeckSelect
:
React
.
FC
<
{
decks
:
readonly
{
deckName
:
string
}[];
decks
:
readonly
{
deckName
:
string
}[];
...
@@ -24,6 +25,7 @@ export const DeckSelect: React.FC<{
...
@@ -24,6 +25,7 @@ export const DeckSelect: React.FC<{
}
>
=
({
decks
,
selected
,
onSelect
,
onDelete
,
onDownload
,
onCopy
})
=>
{
}
>
=
({
decks
,
selected
,
onSelect
,
onDelete
,
onDownload
,
onCopy
})
=>
{
const
newDeck
=
useRef
<
IDeck
[]
>
([]);
const
newDeck
=
useRef
<
IDeck
[]
>
([]);
const
{
modal
,
message
}
=
App
.
useApp
();
const
{
modal
,
message
}
=
App
.
useApp
();
const
{
t
:
i18n
}
=
useTranslation
(
"
DeckSelect
"
);
/** 创建卡组,直接给一个命名,用户可以手动修改,无需modal打断流程 */
/** 创建卡组,直接给一个命名,用户可以手动修改,无需modal打断流程 */
const
createNewDeck
=
async
()
=>
{
const
createNewDeck
=
async
()
=>
{
...
@@ -104,17 +106,17 @@ export const DeckSelect: React.FC<{
...
@@ -104,17 +106,17 @@ export const DeckSelect: React.FC<{
const
items
:
MenuProps
[
"
items
"
]
=
[
const
items
:
MenuProps
[
"
items
"
]
=
[
{
{
label
:
"
新建卡组
"
,
label
:
`
${
i18n
(
"
CreateNewDeck
"
)}
`
,
icon
:
<
PlusOutlined
/>,
icon
:
<
PlusOutlined
/>,
onClick
:
createNewDeck
,
onClick
:
createNewDeck
,
},
},
{
{
label
:
"
从本地文件导入
"
,
label
:
`
${
i18n
(
"
ImportFromLocalFile
"
)}
`
,
icon
:
<
FileAddOutlined
/>,
icon
:
<
FileAddOutlined
/>,
onClick
:
showUploadModal
,
onClick
:
showUploadModal
,
},
},
{
{
label
:
"
从剪贴板导入
"
,
label
:
`
${
i18n
(
"
ImportFromClipboard
"
)}
`
,
icon
:
<
CopyOutlined
/>,
icon
:
<
CopyOutlined
/>,
onClick
:
importFromClipboard
,
onClick
:
importFromClipboard
,
},
},
...
@@ -140,8 +142,8 @@ export const DeckSelect: React.FC<{
...
@@ -140,8 +142,8 @@ export const DeckSelect: React.FC<{
onClick=
{
cancelBubble
(
async
()
=>
{
onClick=
{
cancelBubble
(
async
()
=>
{
const
result
=
await
onCopy
(
deckName
);
const
result
=
await
onCopy
(
deckName
);
result
result
?
message
.
success
(
"
复制成功
"
)
?
message
.
success
(
`${i18n("CopySuccessful")}`
)
:
message
.
error
(
"
复制失败
"
);
:
message
.
error
(
`${i18n("CopyFailed")}`
);
})
}
})
}
/>
/>
<
Button
<
Button
...
@@ -182,6 +184,7 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
...
@@ -182,6 +184,7 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
})
=>
{
})
=>
{
const
[
uploadState
,
setUploadState
]
=
useState
(
""
);
const
[
uploadState
,
setUploadState
]
=
useState
(
""
);
const
{
message
}
=
App
.
useApp
();
const
{
message
}
=
App
.
useApp
();
const
{
t
:
i18n
}
=
useTranslation
(
"
DeckSelect
"
);
const
uploadProps
:
UploadProps
=
{
const
uploadProps
:
UploadProps
=
{
name
:
"
file
"
,
name
:
"
file
"
,
multiple
:
true
,
multiple
:
true
,
...
@@ -213,8 +216,8 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
...
@@ -213,8 +216,8 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
return
(
return
(
<
Uploader
<
Uploader
{
...
uploadProps
}
{
...
uploadProps
}
text=
"单击或拖动文件到此区域进行上传"
text=
{
i18n
(
"
ClickOrDragFilesHereToUpload
"
)
}
hint=
"仅支持后缀名为ydk的卡组文件。"
hint=
{
i18n
(
"
SupportsYdkExtension
"
)
}
/>
/>
);
);
};
};
...
...
src/ui/BuildDeck/index.tsx
View file @
6aafbde0
...
@@ -92,10 +92,10 @@ export const Component: React.FC = () => {
...
@@ -92,10 +92,10 @@ export const Component: React.FC = () => {
);
);
const
{
message
}
=
App
.
useApp
();
const
{
message
}
=
App
.
useApp
();
const
{
t
:
i18n
}
=
useTranslation
(
"
BuildDeck
"
);
const
handleDeckEditorReset
=
async
()
=>
{
const
handleDeckEditorReset
=
async
()
=>
{
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
selectedDeck
));
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
selectedDeck
));
message
.
info
(
"
重置成功
"
);
message
.
info
(
`
${
i18n
(
"
ResetSuccessful
"
)}
`
);
};
};
const
handleDeckEditorSave
=
async
()
=>
{
const
handleDeckEditorSave
=
async
()
=>
{
...
@@ -103,7 +103,7 @@ export const Component: React.FC = () => {
...
@@ -103,7 +103,7 @@ export const Component: React.FC = () => {
const
result
=
await
deckStore
.
update
(
selectedDeck
.
deckName
,
tmpIDeck
);
const
result
=
await
deckStore
.
update
(
selectedDeck
.
deckName
,
tmpIDeck
);
if
(
result
)
{
if
(
result
)
{
setSelectedDeck
(
tmpIDeck
);
setSelectedDeck
(
tmpIDeck
);
message
.
info
(
"
保存成功
"
);
message
.
info
(
`
${
i18n
(
"
SaveSuccessful
"
)}
`
);
editDeckStore
.
edited
=
false
;
editDeckStore
.
edited
=
false
;
}
else
{
}
else
{
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
selectedDeck
));
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
selectedDeck
));
...
...
src/ui/BuildDeck/store.ts
View file @
6aafbde0
...
@@ -7,6 +7,12 @@ import { Type } from "@/ui/Shared/DeckZone";
...
@@ -7,6 +7,12 @@ import { Type } from "@/ui/Shared/DeckZone";
import
{
compareCards
,
type
EditingDeck
}
from
"
./utils
"
;
import
{
compareCards
,
type
EditingDeck
}
from
"
./utils
"
;
const
language
=
localStorage
.
getItem
(
"
language
"
);
const
cardTypeNotMatch
=
language
===
'
en
'
?
"
The Card Type does not match
"
:
"
卡片种类不符合
"
;
const
exceedsNumberCardsSameName
=
language
===
'
en
'
?
"
Exceeds the number of cards with the same name
"
:
"
超过同名卡
"
;
const
limitCards
=
language
===
'
en
'
?
'
Limit of cards
'
:
'
张的上限
'
;
const
exceedsLimit
=
language
===
'
en
'
?
'
Exceeds the limit
'
:
'
超过
'
;
const
cannotAddTokens
=
language
===
'
en
'
?
'
Cannot add tokens
'
:
'
不能添加衍生物
'
;
export
const
editDeckStore
=
proxy
({
export
const
editDeckStore
=
proxy
({
deckName
:
""
,
deckName
:
""
,
main
:
[]
as
CardMeta
[],
main
:
[]
as
CardMeta
[],
...
@@ -75,13 +81,13 @@ export const editDeckStore = proxy({
...
@@ -75,13 +81,13 @@ export const editDeckStore = proxy({
if
(
isToken
(
cardType
))
{
if
(
isToken
(
cardType
))
{
result
=
false
;
result
=
false
;
reason
=
"
不能添加衍生物
"
;
reason
=
cannotAddTokens
;
}
}
const
countLimit
=
type
===
"
main
"
?
60
:
15
;
const
countLimit
=
type
===
"
main
"
?
60
:
15
;
if
(
deckType
.
length
>=
countLimit
)
{
if
(
deckType
.
length
>=
countLimit
)
{
result
=
false
;
result
=
false
;
reason
=
`
超过
${
countLimit
}
张的上限
`
;
reason
=
`
${
exceedsLimit
}
${
countLimit
}
${
limitCards
}
`
;
}
}
if
(
if
(
...
@@ -89,9 +95,8 @@ export const editDeckStore = proxy({
...
@@ -89,9 +95,8 @@ export const editDeckStore = proxy({
(
type
===
"
main
"
&&
isExtraDeckCard
(
cardType
))
(
type
===
"
main
"
&&
isExtraDeckCard
(
cardType
))
)
{
)
{
result
=
false
;
result
=
false
;
reason
=
"
卡片种类不符合
"
;
reason
=
cardTypeNotMatch
;
}
}
const
max
=
3
;
// 这里无需参考禁卡表
const
max
=
3
;
// 这里无需参考禁卡表
const
numOfSameCards
=
const
numOfSameCards
=
editDeckStore
editDeckStore
...
@@ -105,7 +110,7 @@ export const editDeckStore = proxy({
...
@@ -105,7 +110,7 @@ export const editDeckStore = proxy({
if
(
numOfSameCards
>=
max
)
{
if
(
numOfSameCards
>=
max
)
{
result
=
false
;
result
=
false
;
reason
=
`
超过同名卡
${
max
}
张的上限
`
;
reason
=
`
${
exceedsNumberCardsSameName
}
${
max
}
${
limitCards
}
`
;
}
}
return
{
result
,
reason
};
return
{
result
,
reason
};
...
...
src/ui/I18N/Source/Chinese/translation.json
View file @
6aafbde0
...
@@ -59,7 +59,9 @@
...
@@ -59,7 +59,9 @@
"StarsRanksLevelsLinkFromHighToLow"
:
"星/阶/刻/Link从高到低"
,
"StarsRanksLevelsLinkFromHighToLow"
:
"星/阶/刻/Link从高到低"
,
"StarsRanksLevelsLinkFromLowToHigh"
:
"星/阶/刻/Link从低到高"
,
"StarsRanksLevelsLinkFromLowToHigh"
:
"星/阶/刻/Link从低到高"
,
"PendulumScaleFromHighToLow"
:
"灵摆刻度从高到低"
,
"PendulumScaleFromHighToLow"
:
"灵摆刻度从高到低"
,
"PendulumScaleFromLowToHigh"
:
"灵摆刻度从低到高"
"PendulumScaleFromLowToHigh"
:
"灵摆刻度从低到高"
,
"ResetSuccessful"
:
"重置成功"
,
"SaveSuccessful"
:
"保存成功"
},
},
"Filter"
:
{
"Filter"
:
{
"CardFilter"
:
"卡片筛选"
,
"CardFilter"
:
"卡片筛选"
,
...
@@ -139,8 +141,14 @@
...
@@ -139,8 +141,14 @@
"RankedMatch"
:
"竞技匹配"
,
"RankedMatch"
:
"竞技匹配"
,
"Versus"
:
"与"
"Versus"
:
"与"
},
},
"Store"
:
{
"DeckSelect"
:
{
"CannotAddTokens"
:
"不能添加衍生物"
,
"CopySuccessful"
:
"复制成功"
,
"CardTypeDoesNotMatch"
:
"卡片种类不符合"
"CopyFailed"
:
"复制失败"
,
"CreateNewDeck"
:
"新建卡组"
,
"ImportFromLocalFile"
:
"从本地文件导入"
,
"ImportFromClipboard"
:
"从剪贴板导入"
,
"ClickOrDragFilesHereToUpload"
:
"单击或拖动文件到此区域进行上传"
,
"SupportsYdkExtension"
:
"仅支持后缀名为ydk的卡组文件。"
,
"UnableToReadClipboardContent"
:
"无法读取剪贴板内容:"
}
}
}
}
\ No newline at end of file
src/ui/I18N/Source/English/translation.json
View file @
6aafbde0
...
@@ -59,7 +59,9 @@
...
@@ -59,7 +59,9 @@
"StarsRanksLevelsLinkFromHighToLow"
:
"Stars/Ranks/Levels/Link from high to low"
,
"StarsRanksLevelsLinkFromHighToLow"
:
"Stars/Ranks/Levels/Link from high to low"
,
"StarsRanksLevelsLinkFromLowToHigh"
:
"Stars/Ranks/Levels/Link from low to high"
,
"StarsRanksLevelsLinkFromLowToHigh"
:
"Stars/Ranks/Levels/Link from low to high"
,
"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"
,
"SaveSuccessful"
:
"Save successful"
},
},
"Filter"
:
{
"Filter"
:
{
"CardFilter"
:
"Card Filter"
,
"CardFilter"
:
"Card Filter"
,
...
@@ -139,8 +141,14 @@
...
@@ -139,8 +141,14 @@
"RankedMatch"
:
"Ranked Match"
,
"RankedMatch"
:
"Ranked Match"
,
"Versus"
:
"vs"
"Versus"
:
"vs"
},
},
"Store"
:
{
"DeckSelect"
:
{
"CannotAddTokens"
:
"Cannot add Tokens"
,
"CopySuccessful"
:
"Copy successful"
,
"CardTypeDoesNotMatch"
:
"The card type does not match"
"CopyFailed."
:
"Copy failed"
,
"CreateNewDeck"
:
"Create new deck"
,
"ImportFromLocalFile"
:
"Import from local file"
,
"ImportFromClipboard"
:
"Import from clipboard"
,
"ClickOrDragFilesHereToUpload"
:
"Click or drag files here to upload"
,
"SupportsYdkExtension"
:
"Only supports deck files with the .ydk extension."
,
"UnableToReadClipboardContent"
:
"Unable to read clipboard content."
}
}
}
}
\ No newline at end of file
src/ui/I18N/index.ts
View file @
6aafbde0
...
@@ -22,9 +22,9 @@ const resources = {
...
@@ -22,9 +22,9 @@ const resources = {
Filter
:
translationChinese
.
Filter
,
Filter
:
translationChinese
.
Filter
,
CardDetails
:
translationChinese
.
CardDetails
,
CardDetails
:
translationChinese
.
CardDetails
,
WaitRoom
:
translationChinese
.
WaitRoom
,
WaitRoom
:
translationChinese
.
WaitRoom
,
Store
:
translationChinese
.
Store
,
CustomRoomContent
:
translationChinese
.
CustomRoomContent
,
CustomRoomContent
:
translationChinese
.
CustomRoomContent
,
WatchContent
:
translationChinese
.
WatchContent
,
WatchContent
:
translationChinese
.
WatchContent
,
DeckSelect
:
translationChinese
.
DeckSelect
,
},
},
en
:
{
en
:
{
Header
:
translationEnglish
.
Header
,
Header
:
translationEnglish
.
Header
,
...
@@ -34,9 +34,9 @@ const resources = {
...
@@ -34,9 +34,9 @@ const resources = {
Filter
:
translationEnglish
.
Filter
,
Filter
:
translationEnglish
.
Filter
,
CardDetails
:
translationEnglish
.
CardDetails
,
CardDetails
:
translationEnglish
.
CardDetails
,
WaitRoom
:
translationEnglish
.
WaitRoom
,
WaitRoom
:
translationEnglish
.
WaitRoom
,
Store
:
translationEnglish
.
Store
,
CustomRoomContent
:
translationEnglish
.
CustomRoomContent
,
CustomRoomContent
:
translationEnglish
.
CustomRoomContent
,
WatchContent
:
translationEnglish
.
WatchContent
WatchContent
:
translationEnglish
.
WatchContent
,
DeckSelect
:
translationEnglish
.
DeckSelect
,
},
},
es
:
{
es
:
{
Header
:
translationSpanish
.
Header
,
Header
:
translationSpanish
.
Header
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment