mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 06:24:36 +00:00
Fixed bad translation string bug for unit info modal. (#1143)
## Description: Just cleaning up a small oops I let slip through. ## 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      ## Please put your Discord username so you can be contacted if a bug or regression is found: sii
This commit is contained in:
@@ -79,6 +79,12 @@ export class UnitInfoModal extends LitElement implements Layer {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
private buildUnitTypeTranslationString(): string {
|
||||
if (!this.unit) return "unit_type.unknown"; // fallback stays the same
|
||||
const unitType = this.unit.type().toLowerCase().replace(/\s+/g, "_");
|
||||
return `unit_type.${unitType}`;
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
position: fixed;
|
||||
@@ -176,7 +182,7 @@ export class UnitInfoModal extends LitElement implements Layer {
|
||||
</div>
|
||||
<div style="margin-bottom: 4px;">
|
||||
<strong>${translateText("unit_info_modal.type")}:</strong>
|
||||
${translateText(+"unit_type." + this.unit.type?.().toLowerCase()) ??
|
||||
${translateText(this.buildUnitTypeTranslationString()) ??
|
||||
translateText("unit_info_modal.unit_type_unknown")}
|
||||
<strong
|
||||
style="display: ${this.game.unitInfo(this.unit.type()).upgradable
|
||||
|
||||
Reference in New Issue
Block a user