Skip to content

fix: gym battle text ignores language setting (en)#58

Open
Staninna wants to merge 12 commits into
ThunderConch:masterfrom
Staninna:fix/gym-english-messages
Open

fix: gym battle text ignores language setting (en)#58
Staninna wants to merge 12 commits into
ThunderConch:masterfrom
Staninna:fix/gym-english-messages

Conversation

@Staninna
Copy link
Copy Markdown

@Staninna Staninna commented Apr 29, 2026

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 existing t() system. Claude hotfixed it locally, I'm yolo-PRing upstream.

What changed

src/core/turn-battle.ts

  • Move announcement {name}의 {move}!t('battle.used_move', ...) (locale-selects nameEn vs nameKo)
  • Effectiveness messages (효과가 굉장했다! etc.) → t('battle.effect_super/not_very/immune')
  • Faint message {name}은(는) 쓰러졌다!t('battle.fainted', ...)
  • Struggle messages → t('battle.struggle', ...)
  • Surrender messages 항복했다...t('battle.surrender')

src/cli/battle-turn.ts

  • All gym.leaderKo in t() calls → gym.leader (English name)
  • Badge name rendered as e.g. Boulder Badge in English locale
  • Champion region derived from gym.badge key instead of stripping 챔피언배지 suffix
  • Gym-already-cleared rejection → t('gym.already_cleared', ...)
  • moveOptions JSON now includes nameEn alongside nameKo

src/core/volatile-status.ts

  • Confusion faint → t('battle.fainted', ...)

src/status-line.ts

  • Gym status bar: 웅의 체육관 — rockt('gym.status_line', ...)Brock's Gym — rock
  • Signature move name in PP bar: was always sigMove.move_ko, now uses move_en when lang !== 'ko'

src/battle-tui/game-loop.ts

  • Opponent sent-out, player-go, battle-start messages — all via t()

src/battle-tui/renderer.ts

  • Gym header, switch/surrender button labels, yes/no confirm, victory/defeat banners, badge display
  • Move name display now uses nameEn when locale is en

src/battle-tui/index.ts

  • Champion victory detail and badge-earned message — leader/badge names locale-aware

src/cli/gym-list.ts

  • Title, empty notice, badge count, error message, leader/badge display — all via t() / getLocale()

src/cli/moves.ts

  • Category labels (Physical/Special), all error strings, move name display (nameEn for English), swap success/usage — all locale-aware

src/friendly-battle/battle-adapter.ts

  • Surrender message via t('battle.surrender')

src/friendly-battle/daemon.ts

  • Opponent/self battle context labels in buildBattleContext and snapshot fallback via t()

src/friendly-battle/spike/tcp-direct.ts

  • Transport timeout error via t('fb.transport.timeout'); remaining Korean error strings converted to English (crash-log level, not user-facing UI)

src/cli/friendly-battle-spike.ts

  • All nextAction and stage-timeout messages converted from Korean to English

src/i18n/en.json + ko.json

  • Added ~45 new key pairs covering all of the above

Side effects from tooling

New i18n keys were added via json.dump which stripped the blank lines used as section separators throughout both JSON files — cosmetic noise in the diff, no functional change. Also deduplicated a cli.lock_failed key that appeared twice in en.json (kept the shorter variant).

Notes

  • Korean locale untouched in intent but I can't actually verify it reads correctly — please check
  • Error messages in tcp-direct.ts network layer are hardcoded English (not i18n'd) — they go to crash logs, leaving for a follow-up if needed
  • The learnable move legend in moves.ts is still an inline if/else locale check rather than a translation key — functional but inconsistent, leaving for follow-up

Test plan

  • config set language en, then start a gym battle — all messages and move buttons show English
  • gym list — shows English gym/badge/leader names
  • moves and moves <name> list — category labels, error messages, legend in English
  • moves <name> swap — swap confirmation in English
  • Status bar shows English gym name during battle
  • Language set to ko — all of the above still show Korean

- 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
@Staninna Staninna marked this pull request as ready for review April 29, 2026 15:03
Copilot AI review requested due to automatic review settings April 29, 2026 15:03
@Staninna
Copy link
Copy Markdown
Author

@copilot please review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 nameEn where 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 thread src/cli/moves.ts
Comment on lines +111 to +112
const learnableLabel = getLocale() === 'ko' ? '습득 가능 기술' : 'Learnable moves';
console.log(` ${BOLD}${displayName}${RESET} ${GRAY}Lv.${pState.level}${RESET} — ${learnableLabel}`);
Comment thread src/status-line.ts
Comment on lines +401 to 402
const gymLine = `⠀⠀⠀⠀⠀⠀⠀⠀${t('gym.status_line', { leader: gym.leader, type: gym.type })}`;
console.log(charWrap(gymLine, printWidth));
Comment thread src/cli/battle-turn.ts
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 }),
Comment thread src/cli/battle-turn.ts
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 thread src/cli/moves.ts
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 thread src/cli/battle-turn.ts
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')],
Copilot AI and others added 6 commits April 29, 2026 16:09
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
@Staninna
Copy link
Copy Markdown
Author

@copilot please review

@Staninna
Copy link
Copy Markdown
Author

@copilot please review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants