fix: gym battle text ignores language setting (en)#58
Open
Staninna wants to merge 12 commits into
Open
Conversation
- battle messages (move used, effectiveness, fainted) now use t() with
proper en/ko i18n keys instead of hardcoded Korean strings
- gym trainer name uses leader (English) instead of leaderKo
- badge name rendered as e.g. "Boulder Badge" in English
- status bar gym line now shows "{leader}'s Gym" in English
- added nameEn field to moveOptions JSON output
- added missing i18n keys: battle.used_move, battle.effect_super,
battle.effect_not_very, battle.effect_immune, battle.fainted,
gym.status_line to both en.json and ko.json
- Struggle announcement and confusion-faint now go through t() using new battle.struggle and battle.fainted keys - Surrender message uses new battle.surrender key - Gym already-cleared rejection uses new gym.already_cleared key (passes region param for Korean interpolation) - Added all new keys to both en.json and ko.json
Covers all strings needed for the subsequent locale fixes across: battle-tui, gym-list CLI, moves CLI, friendly-battle adapter/daemon, tcp-direct transport errors, and friendly-battle-spike CLI.
game-loop.ts: opp sent-out, player go, battle-start messages
renderer.ts: header, switch/surrender buttons, move names (nameEn),
yes/no confirm, victory/defeat banners, badge names
index.ts: champion victory detail, badge-earned message
All now use t() and respect the active locale.
gym-list.ts: title, empty, badge-count, error, leader/badge display
moves.ts: category labels, error messages, move names, legend legend,
swap success/usage — all now locale-aware via t() / getLocale()
battle-adapter.ts: surrender message via t() daemon.ts: opp/self battle context labels via t() tcp-direct.ts: timeout error via t(); remaining Korean error strings → English friendly-battle-spike.ts: nextAction and stage-timeout messages → English
Author
|
@copilot please review |
There was a problem hiding this comment.
Pull request overview
This PR fixes multiple battle/gym/CLI/TUI strings that were hardcoded in Korean by routing them through the existing i18n t() system, and adds the required new translation keys in en.json/ko.json.
Changes:
- Replaced hardcoded Korean battle flow messages (used-move, effectiveness, fainted, struggle, surrender) with
t(...)keys. - Updated gym/battle CLIs and TUI rendering to use locale-aware labels and move names (including adding
nameEnwhere needed). - Added new i18n keys for battle-tui, gym-list, moves CLI, friendly-battle, and transport errors.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/core/turn-battle.ts | Localizes core battle log messages (used move, effectiveness, fainted, struggle, surrender). |
| src/core/volatile-status.ts | Localizes confusion self-damage faint message. |
| src/cli/battle-turn.ts | Localizes gym battle CLI JSON/messages and adds nameEn to move options. |
| src/status-line.ts | Localizes gym status line and signature move name display in the status bar. |
| src/battle-tui/game-loop.ts | Localizes battle-tui runtime messages (start, sent out, switch). |
| src/battle-tui/renderer.ts | Localizes battle-tui header/buttons/move display/end screens. |
| src/battle-tui/index.ts | Localizes badge/champion victory summaries and leader/badge names. |
| src/cli/gym-list.ts | Localizes gym list output (title, empty/error, leader/badge display). |
| src/cli/moves.ts | Localizes moves CLI categories/errors/names and initializes locale for CLI output. |
| src/friendly-battle/battle-adapter.ts | Localizes surrender message in friendly battle adapter. |
| src/friendly-battle/daemon.ts | Localizes daemon battle context labels. |
| src/friendly-battle/spike/tcp-direct.ts | Localizes/English-ifies transport errors (timeout via i18n key). |
| src/cli/friendly-battle-spike.ts | English-ifies friendly-battle spike CLI operational messages. |
| src/i18n/en.json | Adds new English i18n keys used by the above changes. |
| src/i18n/ko.json | Adds new Korean i18n keys used by the above changes. |
Comments suppressed due to low confidence (1)
src/cli/moves.ts:94
- These move lines still include hardcoded Korean labels (e.g.
위력:). With locale=en this will continue to show Korean UI text. Consider moving these labels into i18n (or using a neutral format without Korean words) so the output is fully locale-aware.
console.log(
` ${i + 1}. ${BOLD}${nameDisplay}${RESET} ${GRAY}(${tc}${moveData.type}${GRAY}/${cat})${RESET} 위력:${moveData.power} PP:${moveData.pp}`,
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+111
to
+112
| const learnableLabel = getLocale() === 'ko' ? '습득 가능 기술' : 'Learnable moves'; | ||
| console.log(` ${BOLD}${displayName}${RESET} ${GRAY}Lv.${pState.level}${RESET} — ${learnableLabel}`); |
Comment on lines
+401
to
402
| const gymLine = `⠀⠀⠀⠀⠀⠀⠀⠀${t('gym.status_line', { leader: gym.leader, type: gym.type })}`; | ||
| console.log(charWrap(gymLine, printWidth)); |
Comment on lines
+388
to
390
| t('battle.gym_challenge', { leader: gym.leader }), | ||
| t('battle.send_out', { leader: gym.leader, pokemon: opponentActive.displayName }), | ||
| t('battle.go', { pokemon: playerActive.displayName }), |
| const champRegion = getLocale() === 'ko' | ||
| ? gym.badgeKo.replace(/ 챔피언배지$/, '') | ||
| : gym.badge.replace(/^champion_/, '').replace(/^\w/, c => c.toUpperCase()); | ||
| messages.push(` ${t('gym.champion_victory_detail', { region: champRegion, leader: gym.leader })}`); |
Comment on lines
+191
to
+193
| const badgeName = getLocale() === 'ko' ? gym.badgeKo : `${gym.badge.charAt(0).toUpperCase() + gym.badge.slice(1)} Badge`; | ||
| lines.push(''); | ||
| lines.push(center(`${fg256(typeColor(gym.type))}${gym.badgeKo}${RESET}을(를) 획득했다!`, WIDTH)); | ||
| lines.push(center(`${fg256(typeColor(gym.type))}${t('battle.tui.badge_obtained', { badge: badgeName })}${RESET}`, WIDTH)); |
Comment on lines
+138
to
+142
| if (getLocale() === 'ko') { | ||
| console.log(` ${GREEN}●${RESET} 장착중 ${CYAN}○${RESET} 습득 가능 ${GRAY}·${RESET} 레벨 부족`); | ||
| } else { | ||
| console.log(` ${GREEN}●${RESET} Equipped ${CYAN}○${RESET} Learnable ${GRAY}·${RESET} Level insufficient`); | ||
| } |
Comment on lines
+619
to
620
| messages.push(t('battle.victory', { leader: gym.leader })); | ||
|
|
| const headerText = gym | ||
| ? `${BOLD}${gym.leaderKo}의 체육관${RESET} — ${fg256(typeColor(gym.type))}${gym.type}${RESET} 타입 전문` | ||
| : `${BOLD}배틀${RESET}`; | ||
| ? `${BOLD}${t('battle.tui.gym_name', { leader: gym.leader })}${RESET} — ${fg256(typeColor(gym.type))}${t('battle.tui.type_specialist', { type: gym.type })}${RESET}` |
Comment on lines
+196
to
200
| lines.push(center(`${BOLD}${t('battle.tui.defeat')}${RESET}`, WIDTH)); | ||
| if (gym) { | ||
| lines.push(''); | ||
| lines.push(center(`${gym.leaderKo}에게 졌다...`, WIDTH)); | ||
| lines.push(center(t('battle.tui.defeat_to', { leader: gym.leader }), WIDTH)); | ||
| } |
Comment on lines
195
to
+197
| recentMessages: gym | ||
| ? [`${gym.leaderKo}이(가) 승부를 걸어왔다!`] | ||
| : ['배틀 시작!'], | ||
| ? [t('battle.gym_challenge', { leader: gym.leader })] | ||
| : [t('battle.battle_start')], |
Agent-Logs-Url: https://github.com/Staninna/tkm/sessions/f2465532-dc33-4346-ae39-a4372a2b13c5 Co-authored-by: Staninna <26458805+Staninna@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Staninna/tkm/sessions/f2465532-dc33-4346-ae39-a4372a2b13c5 Co-authored-by: Staninna <26458805+Staninna@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Staninna/tkm/sessions/f2465532-dc33-4346-ae39-a4372a2b13c5 Co-authored-by: Staninna <26458805+Staninna@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Staninna/tkm/sessions/f2465532-dc33-4346-ae39-a4372a2b13c5 Co-authored-by: Staninna <26458805+Staninna@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Staninna/tkm/sessions/f2465532-dc33-4346-ae39-a4372a2b13c5 Co-authored-by: Staninna <26458805+Staninna@users.noreply.github.com>
…nges Finish friendly-battle transport localization and restore daemon/CLI consistency
Author
|
@copilot please review |
Author
|
@copilot please review :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
I don't speak Korean. Everything in tkm was showing Korean text regardless of
language = en— move names, effectiveness messages, trainer names, fainted/surrender messages, the status bar gym line, gym list, moves CLI, battle TUI, friendly battle. All of it hardcoded, bypassing the existingt()system. Claude hotfixed it locally, I'm yolo-PRing upstream.What changed
src/core/turn-battle.ts{name}의 {move}!→t('battle.used_move', ...)(locale-selectsnameEnvsnameKo)효과가 굉장했다!etc.) →t('battle.effect_super/not_very/immune'){name}은(는) 쓰러졌다!→t('battle.fainted', ...)t('battle.struggle', ...)항복했다...→t('battle.surrender')src/cli/battle-turn.tsgym.leaderKoint()calls →gym.leader(English name)Boulder Badgein English localegym.badgekey instead of stripping챔피언배지suffixt('gym.already_cleared', ...)moveOptionsJSON now includesnameEnalongsidenameKosrc/core/volatile-status.tst('battle.fainted', ...)src/status-line.ts웅의 체육관 — rock→t('gym.status_line', ...)→Brock's Gym — rocksigMove.move_ko, now usesmove_enwhenlang !== 'ko'src/battle-tui/game-loop.tst()src/battle-tui/renderer.tsnameEnwhen locale isensrc/battle-tui/index.tssrc/cli/gym-list.tst()/getLocale()src/cli/moves.tsnameEnfor English), swap success/usage — all locale-awaresrc/friendly-battle/battle-adapter.tst('battle.surrender')src/friendly-battle/daemon.tsbuildBattleContextand snapshot fallback viat()src/friendly-battle/spike/tcp-direct.tst('fb.transport.timeout'); remaining Korean error strings converted to English (crash-log level, not user-facing UI)src/cli/friendly-battle-spike.tsnextActionand stage-timeout messages converted from Korean to Englishsrc/i18n/en.json+ko.jsonSide effects from tooling
New i18n keys were added via
json.dumpwhich stripped the blank lines used as section separators throughout both JSON files — cosmetic noise in the diff, no functional change. Also deduplicated acli.lock_failedkey that appeared twice in en.json (kept the shorter variant).Notes
tcp-direct.tsnetwork layer are hardcoded English (not i18n'd) — they go to crash logs, leaving for a follow-up if neededmoves.tsis still an inlineif/elselocale check rather than a translation key — functional but inconsistent, leaving for follow-upTest plan
config set language en, then start a gym battle — all messages and move buttons show Englishgym list— shows English gym/badge/leader namesmovesandmoves <name> list— category labels, error messages, legend in Englishmoves <name> swap— swap confirmation in Englishko— all of the above still show Korean