diff --git a/resources/lang/en.json b/resources/lang/en.json index f2c01b89b..290353f6a 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -711,7 +711,20 @@ "wants_to_renew_alliance": "{name} wants to renew your alliance", "ignore": "Ignore", "unit_voluntarily_deleted": "Unit voluntarily deleted", - "betrayal_debuff_ends": "{time} seconds left until betrayal debuff ends" + "betrayal_debuff_ends": "{time} seconds left until betrayal debuff ends", + "attack_cancelled_retreat": "Attack cancelled, {troops} soldiers killed during retreat", + "received_gold_from_captured_ship": "Received {gold} gold from ship captured from {name}", + "received_gold_from_trade": "Received {gold} gold from trade with {name}", + "missile_intercepted": "Missile intercepted {unit}", + "mirv_warheads_intercepted": "{count, plural, one {{count} MIRV warhead intercepted} other {{count} MIRV warheads intercepted}}", + "sent_troops_to_player": "Sent {troops} troops to {name}", + "received_troops_from_player": "Received {troops} troops from {name}", + "sent_gold_to_player": "Sent {gold} gold to {name}", + "received_gold_from_player": "Received {gold} gold from {name}", + "unit_captured_by_enemy": "Your {unit} was captured by {name}", + "captured_enemy_unit": "Captured {unit} from {name}", + "unit_destroyed": "Your {unit} was destroyed", + "no_boats_available": "No boats available, max {max}" }, "unit_info_modal": { "structure_info": "Structure Info", diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 3adf24f75..bd4b72095 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -189,9 +189,11 @@ export class AttackExecution implements Execution { const deaths = this.attack.troops() * (malusPercent / 100); if (deaths) { this.mg.displayMessage( - `Attack cancelled, ${renderTroops(deaths)} soldiers killed during retreat.`, + "events_display.attack_cancelled_retreat", MessageType.ATTACK_CANCELLED, this._owner.id(), + undefined, + { troops: renderTroops(deaths) }, ); } if (this.removeTroops === false && this.sourceTile === null) { diff --git a/src/core/execution/SAMLauncherExecution.ts b/src/core/execution/SAMLauncherExecution.ts index 4d0362c51..c723df0d8 100644 --- a/src/core/execution/SAMLauncherExecution.ts +++ b/src/core/execution/SAMLauncherExecution.ts @@ -272,9 +272,11 @@ export class SAMLauncherExecution implements Execution { // Message this.mg.displayMessage( - `${mirvWarheadTargets.length} MIRV warheads intercepted`, + "events_display.mirv_warheads_intercepted", MessageType.SAM_HIT, samOwner.id(), + undefined, + { count: mirvWarheadTargets.length }, ); mirvWarheadTargets.forEach(({ unit: u }) => { diff --git a/src/core/execution/SAMMissileExecution.ts b/src/core/execution/SAMMissileExecution.ts index e313acd8c..a8d0862f6 100644 --- a/src/core/execution/SAMMissileExecution.ts +++ b/src/core/execution/SAMMissileExecution.ts @@ -61,9 +61,11 @@ export class SAMMissileExecution implements Execution { ); if (result === true) { this.mg.displayMessage( - `Missile intercepted ${this.target.type()}`, + "events_display.missile_intercepted", MessageType.SAM_HIT, this._owner.id(), + undefined, + { unit: this.target.type() }, ); this.active = false; this.target.delete(true, this._owner); diff --git a/src/core/execution/TradeShipExecution.ts b/src/core/execution/TradeShipExecution.ts index f1230c6f4..c421e17aa 100644 --- a/src/core/execution/TradeShipExecution.ts +++ b/src/core/execution/TradeShipExecution.ts @@ -142,10 +142,14 @@ export class TradeShipExecution implements Execution { if (this.wasCaptured) { this.tradeShip!.owner().addGold(gold, this._dstPort.tile()); this.mg.displayMessage( - `Received ${renderNumber(gold)} gold from ship captured from ${this.origOwner.displayName()}`, + "events_display.received_gold_from_captured_ship", MessageType.CAPTURED_ENEMY_UNIT, this.tradeShip!.owner().id(), gold, + { + gold: renderNumber(gold), + name: this.origOwner.displayName(), + }, ); // Record stats this.mg @@ -155,16 +159,24 @@ export class TradeShipExecution implements Execution { this.srcPort.owner().addGold(gold); this._dstPort.owner().addGold(gold, this._dstPort.tile()); this.mg.displayMessage( - `Received ${renderNumber(gold)} gold from trade with ${this.srcPort.owner().displayName()}`, + "events_display.received_gold_from_trade", MessageType.RECEIVED_GOLD_FROM_TRADE, this._dstPort.owner().id(), gold, + { + gold: renderNumber(gold), + name: this.srcPort.owner().displayName(), + }, ); this.mg.displayMessage( - `Received ${renderNumber(gold)} gold from trade with ${this._dstPort.owner().displayName()}`, + "events_display.received_gold_from_trade", MessageType.RECEIVED_GOLD_FROM_TRADE, this.srcPort.owner().id(), gold, + { + gold: renderNumber(gold), + name: this._dstPort.owner().displayName(), + }, ); // Record stats this.mg diff --git a/src/core/execution/TransportShipExecution.ts b/src/core/execution/TransportShipExecution.ts index 776644aa2..b5a8c2d2f 100644 --- a/src/core/execution/TransportShipExecution.ts +++ b/src/core/execution/TransportShipExecution.ts @@ -77,9 +77,11 @@ export class TransportShipExecution implements Execution { mg.config().boatMaxNumber() ) { mg.displayMessage( - `No boats available, max ${mg.config().boatMaxNumber()}`, + "events_display.no_boats_available", MessageType.ATTACK_FAILED, this.attacker.id(), + undefined, + { max: mg.config().boatMaxNumber() }, ); this.active = false; return; @@ -270,9 +272,11 @@ export class TransportShipExecution implements Execution { .boatArriveTroops(this.attacker, this.target, survivors); if (deaths) { this.mg.displayMessage( - `Attack cancelled, ${renderTroops(deaths)} soldiers killed during retreat.`, + "events_display.attack_cancelled_retreat", MessageType.ATTACK_CANCELLED, this.attacker.id(), + undefined, + { troops: renderTroops(deaths) }, ); } return; diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 09c02c5a7..b11c09354 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -665,14 +665,18 @@ export class PlayerImpl implements Player { this.sentDonations.push(new Donation(recipient, this.mg.ticks())); this.mg.displayMessage( - `Sent ${renderTroops(troops)} troops to ${recipient.name()}`, + "events_display.sent_troops_to_player", MessageType.SENT_TROOPS_TO_PLAYER, this.id(), + undefined, + { troops: renderTroops(troops), name: recipient.name() }, ); this.mg.displayMessage( - `Received ${renderTroops(troops)} troops from ${this.name()}`, + "events_display.received_troops_from_player", MessageType.RECEIVED_TROOPS_FROM_PLAYER, recipient.id(), + undefined, + { troops: renderTroops(troops), name: this.name() }, ); return true; } @@ -685,15 +689,18 @@ export class PlayerImpl implements Player { this.sentDonations.push(new Donation(recipient, this.mg.ticks())); this.mg.displayMessage( - `Sent ${renderNumber(gold)} gold to ${recipient.name()}`, + "events_display.sent_gold_to_player", MessageType.SENT_GOLD_TO_PLAYER, this.id(), + undefined, + { gold: renderNumber(gold), name: recipient.name() }, ); this.mg.displayMessage( - `Received ${renderNumber(gold)} gold from ${this.name()}`, + "events_display.received_gold_from_player", MessageType.RECEIVED_GOLD_FROM_PLAYER, recipient.id(), gold, + { gold: renderNumber(gold), name: this.name() }, ); return true; } diff --git a/src/core/game/UnitImpl.ts b/src/core/game/UnitImpl.ts index fad1f02f0..67791b458 100644 --- a/src/core/game/UnitImpl.ts +++ b/src/core/game/UnitImpl.ts @@ -206,14 +206,18 @@ export class UnitImpl implements Unit { this._owner._units.push(this); this.mg.addUpdate(this.toUpdate()); this.mg.displayMessage( - `Your ${this.type()} was captured by ${newOwner.displayName()}`, + "events_display.unit_captured_by_enemy", MessageType.UNIT_CAPTURED_BY_ENEMY, this._lastOwner.id(), + undefined, + { unit: this.type(), name: newOwner.displayName() }, ); this.mg.displayMessage( - `Captured ${this.type()} from ${this._lastOwner.displayName()}`, + "events_display.captured_enemy_unit", MessageType.CAPTURED_ENEMY_UNIT, newOwner.id(), + undefined, + { unit: this.type(), name: this._lastOwner.displayName() }, ); } @@ -304,9 +308,11 @@ export class UnitImpl implements Unit { } this.mg.displayMessage( - `Your ${this._type} was destroyed`, + "events_display.unit_destroyed", MessageType.UNIT_DESTROYED, this.owner().id(), + undefined, + { unit: this._type }, ); }