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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
baichixing
Neos
Commits
c0b1d41c
Commit
c0b1d41c
authored
Jun 11, 2024
by
BBeretta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat/language-translation (error message, interactions string)
parent
8d8d1213
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
15 deletions
+43
-15
src/service/room/errorMsg.ts
src/service/room/errorMsg.ts
+4
-1
src/ui/Duel/PlayMat/Menu/index.tsx
src/ui/Duel/PlayMat/Menu/index.tsx
+5
-4
src/ui/Duel/utils/interactTypeToStringIcon.tsx
src/ui/Duel/utils/interactTypeToStringIcon.tsx
+17
-7
src/ui/I18N/Source/Chinese/translation.json
src/ui/I18N/Source/Chinese/translation.json
+7
-1
src/ui/I18N/Source/English/translation.json
src/ui/I18N/Source/English/translation.json
+7
-1
src/ui/I18N/index.ts
src/ui/I18N/index.ts
+2
-0
src/ui/Match/MatchModal/index.tsx
src/ui/Match/MatchModal/index.tsx
+1
-1
No files found.
src/service/room/errorMsg.ts
View file @
c0b1d41c
...
@@ -14,6 +14,9 @@ const DECKERROR_EXTRACOUNT = 0x7;
...
@@ -14,6 +14,9 @@ const DECKERROR_EXTRACOUNT = 0x7;
const
DECKERROR_SIDECOUNT
=
0x8
;
const
DECKERROR_SIDECOUNT
=
0x8
;
const
DECKERROR_NOTAVAIL
=
0x9
;
const
DECKERROR_NOTAVAIL
=
0x9
;
const
language
=
localStorage
.
getItem
(
'
language
'
);
const
mainDeckWarining
=
language
===
'
en
'
?
'
The main deck should contain 40-60 cards.
'
:
'
主卡组数量应为40-60张
'
;
export
default
async
function
handleErrorMsg
(
errorMsg
:
ygopro
.
StocErrorMsg
)
{
export
default
async
function
handleErrorMsg
(
errorMsg
:
ygopro
.
StocErrorMsg
)
{
const
{
error_type
,
error_code
}
=
errorMsg
;
const
{
error_type
,
error_code
}
=
errorMsg
;
switch
(
error_type
)
{
switch
(
error_type
)
{
...
@@ -55,7 +58,7 @@ export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
...
@@ -55,7 +58,7 @@ export default async function handleErrorMsg(errorMsg: ygopro.StocErrorMsg) {
break
;
break
;
}
}
case
DECKERROR_MAINCOUNT
:
{
case
DECKERROR_MAINCOUNT
:
{
roomStore
.
errorMsg
=
"
主卡组数量应为40-60张
"
;
roomStore
.
errorMsg
=
mainDeckWarining
;
break
;
break
;
}
}
case
DECKERROR_EXTRACOUNT
:
{
case
DECKERROR_EXTRACOUNT
:
{
...
...
src/ui/Duel/PlayMat/Menu/index.tsx
View file @
c0b1d41c
...
@@ -33,6 +33,7 @@ import styles from "./index.module.scss";
...
@@ -33,6 +33,7 @@ import styles from "./index.module.scss";
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
import
PhaseType
=
ygopro
.
StocGameMessage
.
MsgNewPhase
.
PhaseType
;
import
{
clearAllIdleInteractivities
,
clearSelectInfo
}
from
"
../../utils
"
;
import
{
clearAllIdleInteractivities
,
clearSelectInfo
}
from
"
../../utils
"
;
import
{
openChatBox
}
from
"
../ChatBox
"
;
import
{
openChatBox
}
from
"
../ChatBox
"
;
import
{
useTranslation
}
from
"
react-i18next
"
;
const
{
useToken
}
=
theme
;
const
{
useToken
}
=
theme
;
...
@@ -60,6 +61,7 @@ const initialPhaseBind: [
...
@@ -60,6 +61,7 @@ const initialPhaseBind: [
];
];
export
const
Menu
=
()
=>
{
export
const
Menu
=
()
=>
{
const
{
t
:
i18n
}
=
useTranslation
(
"
Menu
"
);
const
{
const
{
currentPlayer
,
currentPlayer
,
chainSetting
,
chainSetting
,
...
@@ -136,13 +138,12 @@ export const Menu = () => {
...
@@ -136,13 +138,12 @@ export const Menu = () => {
},
},
}),
}),
);
);
const
surrenderMenuItems
:
MenuProps
[
"
items
"
]
=
[
const
surrenderMenuItems
:
MenuProps
[
"
items
"
]
=
[
{
{
label
:
"
取消
"
,
label
:
i18n
(
"
Cancel
"
)
,
},
},
{
{
label
:
"
确定
"
,
label
:
i18n
(
"
Confirm
"
)
,
danger
:
true
,
danger
:
true
,
onClick
:
sendSurrender
,
onClick
:
sendSurrender
,
},
},
...
@@ -184,7 +185,7 @@ export const Menu = () => {
...
@@ -184,7 +185,7 @@ export const Menu = () => {
></
Button
>
></
Button
>
</
Tooltip
>
</
Tooltip
>
<
DropdownWithTitle
<
DropdownWithTitle
title=
"是否投降?"
title=
{
i18n
(
"
DoYouSurrunder
"
)
}
menu=
{
{
items
:
surrenderMenuItems
}
}
menu=
{
{
items
:
surrenderMenuItems
}
}
>
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
...
...
src/ui/Duel/utils/interactTypeToStringIcon.tsx
View file @
c0b1d41c
...
@@ -4,22 +4,32 @@ import { IconFont } from "@/ui/Shared";
...
@@ -4,22 +4,32 @@ import { IconFont } from "@/ui/Shared";
import
CardPosition
=
ygopro
.
CardPosition
;
import
CardPosition
=
ygopro
.
CardPosition
;
const
language
=
localStorage
.
getItem
(
'
language
'
);
const
sSet
=
language
===
'
en
'
?
'
Set
'
:
'
后场放置
'
;
const
summon
=
language
===
'
en
'
?
'
Normal Summon
'
:
'
普通召唤
'
;
const
spSummon
=
language
===
'
en
'
?
'
Special Summon
'
:
'
特殊召唤
'
;
const
posChange
=
language
===
'
en
'
?
'
Change Position
'
:
'
改变表示形式
'
;
const
mSet
=
language
===
'
en
'
?
'
Set
'
:
'
前场放置
'
;
const
activate
=
language
===
'
en
'
?
'
Activate
'
:
'
发动效果
'
;
const
attack
=
language
===
'
en
'
?
'
Attack
'
:
'
攻击
'
;
export
function
interactTypeToString
(
t
:
InteractType
):
string
{
export
function
interactTypeToString
(
t
:
InteractType
):
string
{
switch
(
t
)
{
switch
(
t
)
{
case
InteractType
.
SUMMON
:
case
InteractType
.
SUMMON
:
return
"
普通召唤
"
;
return
summon
;
case
InteractType
.
SP_SUMMON
:
case
InteractType
.
SP_SUMMON
:
return
"
特殊召唤
"
;
return
spSummon
;
case
InteractType
.
POS_CHANGE
:
case
InteractType
.
POS_CHANGE
:
return
"
改变表示形式
"
;
return
posChange
;
case
InteractType
.
MSET
:
case
InteractType
.
MSET
:
return
"
前场放置
"
;
return
mSet
;
case
InteractType
.
SSET
:
case
InteractType
.
SSET
:
return
"
后场放置
"
;
return
sSet
;
case
InteractType
.
ACTIVATE
:
case
InteractType
.
ACTIVATE
:
return
"
发动效果
"
;
return
activate
;
case
InteractType
.
ATTACK
:
case
InteractType
.
ATTACK
:
return
"
攻击
"
;
return
attack
;
default
:
default
:
return
"
未知选项
"
;
return
"
未知选项
"
;
}
}
...
...
src/ui/I18N/Source/Chinese/translation.json
View file @
c0b1d41c
...
@@ -160,7 +160,8 @@
...
@@ -160,7 +160,8 @@
"KoishiServer"
:
"Koishi服"
,
"KoishiServer"
:
"Koishi服"
,
"UltraPreemptiveServer"
:
"超先行服"
,
"UltraPreemptiveServer"
:
"超先行服"
,
"PlayerNickname"
:
"玩家昵称"
,
"PlayerNickname"
:
"玩家昵称"
,
"RoomPasswordOptional"
:
"房间密码(可选)"
"RoomPasswordOptional"
:
"房间密码(可选)"
,
"JoinRoom"
:
"加入房间"
},
},
"ReplayModal"
:
{
"ReplayModal"
:
{
"SelectReplay"
:
"选择回放"
,
"SelectReplay"
:
"选择回放"
,
...
@@ -172,5 +173,10 @@
...
@@ -172,5 +173,10 @@
"Popover"
:
{
"Popover"
:
{
"First"
:
"先手"
,
"First"
:
"先手"
,
"Second"
:
"后手"
"Second"
:
"后手"
},
"Menu"
:
{
"DoYouSurrunder"
:
"是否投降?"
,
"Cancel"
:
"取消"
,
"Confirm"
:
"确定"
}
}
}
}
\ No newline at end of file
src/ui/I18N/Source/English/translation.json
View file @
c0b1d41c
...
@@ -160,7 +160,8 @@
...
@@ -160,7 +160,8 @@
"KoishiServer"
:
"Koishi Server"
,
"KoishiServer"
:
"Koishi Server"
,
"UltraPreemptiveServer"
:
"Ultra Preemptive Server"
,
"UltraPreemptiveServer"
:
"Ultra Preemptive Server"
,
"PlayerNickname"
:
"Player Nickname"
,
"PlayerNickname"
:
"Player Nickname"
,
"RoomPasswordOptional"
:
"Room Password (optional)"
"RoomPasswordOptional"
:
"Room Password (optional)"
,
"JoinRoom"
:
"Join the Room"
},
},
"ReplayModal"
:
{
"ReplayModal"
:
{
"SelectReplay"
:
"Select Replay"
,
"SelectReplay"
:
"Select Replay"
,
...
@@ -172,5 +173,10 @@
...
@@ -172,5 +173,10 @@
"Popover"
:
{
"Popover"
:
{
"First"
:
"First"
,
"First"
:
"First"
,
"Second"
:
"Second"
"Second"
:
"Second"
},
"Menu"
:
{
"DoYouSurrunder"
:
"Do you surrender?"
,
"Cancel"
:
"Cancel"
,
"Confirm"
:
"Confirm"
}
}
}
}
\ No newline at end of file
src/ui/I18N/index.ts
View file @
c0b1d41c
...
@@ -29,6 +29,7 @@ const resources = {
...
@@ -29,6 +29,7 @@ const resources = {
MatchModal
:
translationChinese
.
MatchModal
,
MatchModal
:
translationChinese
.
MatchModal
,
ReplayModal
:
translationChinese
.
ReplayModal
,
ReplayModal
:
translationChinese
.
ReplayModal
,
Popover
:
translationChinese
.
Popover
,
Popover
:
translationChinese
.
Popover
,
Menu
:
translationChinese
.
Menu
,
},
},
en
:
{
en
:
{
Header
:
translationEnglish
.
Header
,
Header
:
translationEnglish
.
Header
,
...
@@ -45,6 +46,7 @@ const resources = {
...
@@ -45,6 +46,7 @@ const resources = {
MatchModal
:
translationEnglish
.
MatchModal
,
MatchModal
:
translationEnglish
.
MatchModal
,
ReplayModal
:
translationEnglish
.
ReplayModal
,
ReplayModal
:
translationEnglish
.
ReplayModal
,
Popover
:
translationEnglish
.
Popover
,
Popover
:
translationEnglish
.
Popover
,
Menu
:
translationEnglish
.
Menu
,
},
},
es
:
{
es
:
{
Header
:
translationSpanish
.
Header
,
Header
:
translationSpanish
.
Header
,
...
...
src/ui/Match/MatchModal/index.tsx
View file @
c0b1d41c
...
@@ -93,7 +93,7 @@ export const MatchModal: React.FC = ({}) => {
...
@@ -93,7 +93,7 @@ export const MatchModal: React.FC = ({}) => {
onCancel=
{
()
=>
(
matchStore
.
open
=
false
)
}
onCancel=
{
()
=>
(
matchStore
.
open
=
false
)
}
footer=
{
footer=
{
<
Button
onClick=
{
handleSubmit
}
loading=
{
confirmLoading
}
>
<
Button
onClick=
{
handleSubmit
}
loading=
{
confirmLoading
}
>
加入房间
{
i18n
(
"
JoinRoom
"
)
}
</
Button
>
</
Button
>
}
}
confirmLoading=
{
confirmLoading
}
confirmLoading=
{
confirmLoading
}
...
...
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