Translate displayMessage events via events_display keys (#2847)

If this PR fixes an issue, link it below. If not, delete these two
lines.
Resolves #1225

## Description:

Replace all raw displayMessage strings with events_display.* keys +
params and add the new English translations in resources/
  lang/en.json so EventsDisplay can translate them.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

aotumuri

---------

Co-authored-by: Ryan <7389646+ryanbarlow97@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Aotumuri
2026-01-10 20:10:03 -08:00
committed by GitHub
co-authored by Ryan coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent 778b6867a4
commit 8235da9335
8 changed files with 64 additions and 16 deletions
+9 -3
View File
@@ -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 },
);
}