Adding unit info modal translation support. (#1122)

## Description:
Adding translation support for unit info modal. 
## 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
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

Regression test to make sure UI is still displaying as expected

![image](https://github.com/user-attachments/assets/bad18084-a4bb-479c-a3dd-74c9c541fdb0)

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

sii
This commit is contained in:
its-sii
2025-06-09 18:34:58 -04:00
committed by GitHub
parent bf9b9a4b0d
commit 9401f20436
2 changed files with 16 additions and 5 deletions
+7
View File
@@ -406,6 +406,13 @@
"retreating": "retreating",
"boat": "Boat"
},
"unit_info_modal": {
"structure_info": "Structure Info",
"unit_type_unknown": "Unknown",
"close": "Close",
"cooldown": "Cooldown",
"type": "Type"
},
"relation": {
"hostile": "Hostile",
"distrustful": "Distrustful",
+9 -5
View File
@@ -1,5 +1,6 @@
import { LitElement, css, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { translateText } from "../../../client/Utils";
import { UnitType } from "../../../core/game/Game";
import { GameView, UnitView } from "../../../core/game/GameView";
import { Layer } from "./Layer";
@@ -133,14 +134,17 @@ export class UnitInfoModal extends LitElement implements Layer {
.x}px; top: ${this.y}px; position: absolute;"
>
<div style="margin-bottom: 8px; font-size: 16px; font-weight: bold;">
Structure Info
${translateText("unit_info_modal.structure_info")}
</div>
<div style="margin-bottom: 4px;">
<strong>Type:</strong> ${this.unit.type?.() ?? "Unknown"}
<strong>${translateText("unit_info_modal.type")}:</strong>
${translateText(+"unit_type." + this.unit.type?.().toLowerCase()) ??
translateText("unit_info_modal.unit_type_unknown")}
</div>
${secondsLeft > 0
? html`<div style="margin-bottom: 4px;">
<strong>Cooldown:</strong> ${secondsLeft}s
<strong>${translateText("unit_info_modal.cooldown")}</strong>
${secondsLeft}s
</div>`
: ""}
<div style="margin-top: 14px; display: flex; justify-content: center;">
@@ -152,10 +156,10 @@ export class UnitInfoModal extends LitElement implements Layer {
}
}}
class="close-button"
title="Close"
title="${translateText("unit_info_modal.close")}"
style="width: 100px; height: 32px;"
>
CLOSE
${translateText("unit_info_modal.close")}
</button>
</div>
</div>