diff --git a/play.pokemonshowdown.com/src/panel-battle.tsx b/play.pokemonshowdown.com/src/panel-battle.tsx index c87f37f72..0fd51eef4 100644 --- a/play.pokemonshowdown.com/src/panel-battle.tsx +++ b/play.pokemonshowdown.com/src/panel-battle.tsx @@ -84,11 +84,11 @@ class BattlesPanel extends PSRoomPanel { }; renderBattleLink(battle: BattleDesc) { const format = battle.id.split('-')[1]; - const minEloMessage = typeof battle.minElo === 'number' ? `rated ${battle.minElo}` : battle.minElo; + const minEloMessage = typeof battle.minElo === 'number' ? TL`rated ${battle.minElo}` : battle.minElo; return
{minEloMessage && ({minEloMessage})} [{format}]
- {battle.p1} vs. {battle.p2} + {battle.p1}{TL` vs. `}{battle.p2}
; } override render() { @@ -104,34 +104,37 @@ class BattlesPanel extends PSRoomPanel { {}

- +

{!room.battles ? (

{TL`Loading...`}

) : !room.battles.length ? ( -

No battles are going on

+

{TL`No battles are going on`}

) : (<> -

{room.battles.length === 100 ? - `100+` : room.battles.length} {room.battles.length > 1 ? `battles` : `battle`}

+

{room.battles.length === 1 ? ( + TL`${1} battle` + ) : ( + TL`${room.battles.length === 100 ? '100+' : room.battles.length} battles` + )}

{room.battles.map(battle => this.renderBattleLink(battle))} )}
@@ -163,7 +166,7 @@ export class BattleRoom extends ChatRoom { override interruptClose(explicit?: boolean, elem?: HTMLElement | null) { if (this.isPlaying() || this.requireForfeit) { PS.join('forfeitbattle' as RoomID, { parentElem: elem, parentRoomid: this.id }); - return `You are still in ${this.title}`; + return TL`You are still in ${this.title}`; } return super.interruptClose(explicit, elem); } @@ -171,22 +174,21 @@ export class BattleRoom extends ChatRoom { return this.battle && !this.battle.ended && this.request && this.connectMode !== 'deleted'; } updateChoiceNotification() { - let oName = this.battle?.farSide.name; - if (oName) oName = " against " + oName; + const oName = this.battle?.farSide.name; let title = ''; let body = ''; switch (this.request?.requestType) { case 'move': - title = "Your move!"; - body = "Move in your battle" + oName; + title = BattleTextParser.ui('notifyMoveTitle'); + body = oName ? BattleTextParser.ui('notifyMoveAgainst', { OPPONENT: oName }) : BattleTextParser.ui('notifyMove'); break; case 'switch': - title = "Your switch!"; - body = "Switch in your battle" + oName; + title = BattleTextParser.ui('notifySwitchTitle'); + body = oName ? BattleTextParser.ui('notifySwitchAgainst', { OPPONENT: oName }) : BattleTextParser.ui('notifySwitch'); break; case 'team': - title = "Team preview!"; - body = "Choose your team order in your battle" + oName; + title = BattleTextParser.ui('notifyTeamTitle'); + body = oName ? BattleTextParser.ui('notifyTeamAgainst', { OPPONENT: oName }) : BattleTextParser.ui('notifyTeam'); break; } @@ -235,12 +237,12 @@ export class BattleRoom extends ChatRoom { this.connectError = null; this.update(null); } catch { - this.connectError = `Battle "${replayid}" not found`; + this.connectError = TL`Battle "${replayid}" not found`; if (!this.battle.stepQueue.length) { this.battle.scene.message( `
${BattleLog.escapeHTML(this.connectError)}

` + - `The battle you're looking for has expired. Battles expire after 15 minutes of inactivity unless they're saved.

` + - `In the future, remember to click "Save replay" to save a replay permanently.` + `${TL`The battle you're looking for has expired. Battles expire after 15 minutes of inactivity unless they're saved.`}

` + + TL`In the future, remember to click "Save replay" to save a replay permanently.` ); } this.update(null); @@ -279,7 +281,7 @@ class TimerButton extends preact.Component<{ room: BattleRoom, top: number }> { return `${minutes}:${(seconds < 10 ? '0' : '')}${seconds}`; } render() { - let time = 'Timer'; + let time = TL`Timer`; const room = this.props.room; if (!this.timerInterval && room.battle.kickingInactive) { this.timerInterval = setInterval(() => { @@ -338,7 +340,7 @@ class BattlePanel extends PSRoomPanel { file.text().then(html => { const titleStart = html.indexOf(''); const titleEnd = html.indexOf(''); - let title = 'Uploaded Replay'; + let title = TL`Uploaded Replay`; if (titleStart >= 0 && titleEnd > titleStart) { title = html.slice(titleStart + 7, titleEnd - 1); const colonIndex = title.indexOf(':'); @@ -352,7 +354,7 @@ class BattlePanel extends PSRoomPanel { const index1 = html.indexOf('