mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-06-28 16:35:55 +08:00
fix: 补全 i18n 国际化,消除所有硬编码中文
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -42,10 +42,10 @@ export default function AiGameSetup({ onBack, onStart }: Props) {
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
先手:
|
||||
{t('ai_setup.first_player')}:
|
||||
<select value={playerColor} onChange={(e) => setPlayerColor(e.target.value as Color)}>
|
||||
<option value="Black">黑棋 (先手)</option>
|
||||
<option value="White">白棋 (后手)</option>
|
||||
<option value="Black">{t('ai_setup.black_first')}</option>
|
||||
<option value="White">{t('ai_setup.white_second')}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
@@ -54,7 +54,7 @@ export default function AiGameSetup({ onBack, onStart }: Props) {
|
||||
</label>
|
||||
<div className="setup-actions">
|
||||
<button onClick={handleStart}>{t('game.new_game')}</button>
|
||||
<button onClick={onBack}>返回</button>
|
||||
<button onClick={onBack}>{t('common.back')}</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function LoadReplay({ onBack, onStart }: Props) {
|
||||
<div className="setup-panel">
|
||||
<h2>{t('menu.load_replay')}</h2>
|
||||
<input ref={fileRef} type="file" accept=".json" onChange={handleFile} />
|
||||
<button onClick={onBack} style={{ marginTop: 12 }}>返回</button>
|
||||
<button onClick={onBack} style={{ marginTop: 12 }}>{t('common.back')}</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default function LocalGameSetup({ onBack, onStart }: Props) {
|
||||
<h2>{t('menu.local_game')}</h2>
|
||||
<div className="setup-actions">
|
||||
<button onClick={handleStart}>{t('game.new_game')}</button>
|
||||
<button onClick={onBack}>返回</button>
|
||||
<button onClick={onBack}>{t('common.back')}</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -29,12 +29,12 @@ export default function OnlineSetup({ onBack, onStart }: Props) {
|
||||
return (
|
||||
<div className="setup-panel">
|
||||
<h2>{t('menu.online_game')}</h2>
|
||||
<button onClick={handleHost}>创建房间</button>
|
||||
<button onClick={handleHost}>{t('menu.host_room')}</button>
|
||||
<div style={{ display: 'flex', gap: 8, marginTop: 12 }}>
|
||||
<input value={ip} onChange={(e) => setIp(e.target.value)} placeholder="IP:端口" />
|
||||
<button onClick={handleJoin} disabled={!ip}>加入房间</button>
|
||||
<input value={ip} onChange={(e) => setIp(e.target.value)} placeholder={t('menu.ip_placeholder') as string} />
|
||||
<button onClick={handleJoin} disabled={!ip}>{t('menu.join_room')}</button>
|
||||
</div>
|
||||
<button onClick={onBack} style={{ marginTop: 12 }}>返回</button>
|
||||
<button onClick={onBack} style={{ marginTop: 12 }}>{t('common.back')}</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function ReplayView({ onBackToMenu }: Props) {
|
||||
onPrev={() => setReplayStep(Math.max(0, step - 1))}
|
||||
onNext={() => setReplayStep(Math.min(moves.length, step + 1))}
|
||||
/>
|
||||
<button onClick={onBackToMenu}>返回菜单</button>
|
||||
<button onClick={onBackToMenu}>{t('common.back_to_menu')}</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+13
-1
@@ -1,12 +1,24 @@
|
||||
{
|
||||
"app": { "title": "Gobang v2.0" },
|
||||
"common": {
|
||||
"back": "Back",
|
||||
"back_to_menu": "Back to Menu"
|
||||
},
|
||||
"menu": {
|
||||
"local_game": "Local 2-Player",
|
||||
"ai_game": "VS AI",
|
||||
"online_game": "Online",
|
||||
"online_game_disabled": "Online mode is under development",
|
||||
"load_replay": "Load Replay",
|
||||
"settings": "Settings"
|
||||
"settings": "Settings",
|
||||
"host_room": "Create Room",
|
||||
"join_room": "Join Room",
|
||||
"ip_placeholder": "IP:Port"
|
||||
},
|
||||
"ai_setup": {
|
||||
"first_player": "First Player",
|
||||
"black_first": "Black (First)",
|
||||
"white_second": "White (Second)"
|
||||
},
|
||||
"game": {
|
||||
"black_turn": "Black's Turn",
|
||||
|
||||
+13
-1
@@ -1,12 +1,24 @@
|
||||
{
|
||||
"app": { "title": "五子棋 v2.0" },
|
||||
"common": {
|
||||
"back": "返回",
|
||||
"back_to_menu": "返回菜单"
|
||||
},
|
||||
"menu": {
|
||||
"local_game": "本地双人",
|
||||
"ai_game": "人机对战",
|
||||
"online_game": "网络对战",
|
||||
"online_game_disabled": "网络对战功能开发中",
|
||||
"load_replay": "加载棋谱",
|
||||
"settings": "设置"
|
||||
"settings": "设置",
|
||||
"host_room": "创建房间",
|
||||
"join_room": "加入房间",
|
||||
"ip_placeholder": "IP:端口"
|
||||
},
|
||||
"ai_setup": {
|
||||
"first_player": "先手",
|
||||
"black_first": "黑棋 (先手)",
|
||||
"white_second": "白棋 (后手)"
|
||||
},
|
||||
"game": {
|
||||
"black_turn": "黑棋回合",
|
||||
|
||||
Reference in New Issue
Block a user