fix: translation broke numbers (#211)

This commit is contained in:
Ilan Schemoul
2025-03-11 13:30:47 -07:00
committed by Evan
parent 59cfbca473
commit b9399f576c
7 changed files with 19 additions and 9 deletions
+1 -1
View File
@@ -290,7 +290,7 @@ export class BuildMenu extends LitElement implements Layer {
/> />
<span class="build-name">${item.unitType}</span> <span class="build-name">${item.unitType}</span>
<span class="build-description">${item.description}</span> <span class="build-description">${item.description}</span>
<span class="build-cost"> <span class="build-cost" translate="no">
${renderNumber( ${renderNumber(
this.game && this.game.myPlayer() ? this.cost(item) : 0, this.game && this.game.myPlayer() ? this.cost(item) : 0,
)} )}
+3 -2
View File
@@ -204,6 +204,7 @@ export class ControlPanel extends LitElement implements Layer {
class="${this._popRateIsIncreasing class="${this._popRateIsIncreasing
? "text-green-500" ? "text-green-500"
: "text-yellow-500"}" : "text-yellow-500"}"
translate="no"
>(+${renderTroops(this.popRate)})</span >(+${renderTroops(this.popRate)})</span
></span ></span
> >
@@ -218,7 +219,7 @@ export class ControlPanel extends LitElement implements Layer {
</div> </div>
<div class="relative mb-4 lg:mb-4"> <div class="relative mb-4 lg:mb-4">
<label class="block text-white mb-1" <label class="block text-white mb-1" translate="no"
>Troops: <span translate="no">${renderTroops(this._troops)}</span> | >Troops: <span translate="no">${renderTroops(this._troops)}</span> |
Workers: Workers:
<span translate="no">${renderTroops(this._workers)}</span></label <span translate="no">${renderTroops(this._workers)}</span></label
@@ -250,7 +251,7 @@ export class ControlPanel extends LitElement implements Layer {
</div> </div>
<div class="relative mb-0 lg:mb-4"> <div class="relative mb-0 lg:mb-4">
<label class="block text-white mb-1" <label class="block text-white mb-1" translate="no"
>Attack Ratio: ${(this.attackRatio * 100).toFixed(0)}% >Attack Ratio: ${(this.attackRatio * 100).toFixed(0)}%
(${renderTroops( (${renderTroops(
this.game?.myPlayer()?.troops() * this.attackRatio, this.game?.myPlayer()?.troops() * this.attackRatio,
@@ -408,6 +408,7 @@ export class EventsDisplay extends LitElement implements Layer {
)?.name()} )?.name()}
${!attack.retreating ${!attack.retreating
? html`<button ? html`<button
translate="no"
${attack.retreating ? "disabled" : ""} ${attack.retreating ? "disabled" : ""}
@click=${() => { @click=${() => {
this.emitCancelAttackIntent(attack.id); this.emitCancelAttackIntent(attack.id);
+1
View File
@@ -200,6 +200,7 @@ export class NameLayer implements Layer {
const troopsDiv = document.createElement("div"); const troopsDiv = document.createElement("div");
troopsDiv.classList.add("player-troops"); troopsDiv.classList.add("player-troops");
troopsDiv.setAttribute("translate", "no");
troopsDiv.textContent = renderTroops(player.troops()); troopsDiv.textContent = renderTroops(player.troops());
troopsDiv.style.color = this.theme.textColor(player.info()); troopsDiv.style.color = this.theme.textColor(player.info());
troopsDiv.style.fontFamily = this.theme.font(); troopsDiv.style.fontFamily = this.theme.font();
@@ -201,10 +201,10 @@ export class PlayerInfoOverlay extends LitElement implements Layer {
${player.name()} ${player.name()}
</div> </div>
<div class="text-sm opacity-80">Type: ${playerType}</div> <div class="text-sm opacity-80">Type: ${playerType}</div>
<div class="text-sm opacity-80"> <div class="text-sm opacity-80" translate="no">
Troops: ${renderTroops(player.troops())} Troops: ${renderTroops(player.troops())}
</div> </div>
<div class="text-sm opacity-80"> <div class="text-sm opacity-80" translate="no">
Gold: ${renderNumber(player.gold())} Gold: ${renderNumber(player.gold())}
</div> </div>
${relationHtml} ${relationHtml}
+8 -2
View File
@@ -213,7 +213,10 @@ export class PlayerPanel extends LitElement implements Layer {
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
<!-- Gold --> <!-- Gold -->
<div class="text-white text-opacity-80 text-sm px-2">Gold</div> <div class="text-white text-opacity-80 text-sm px-2">Gold</div>
<div class="bg-opacity-50 bg-gray-700 rounded p-2 text-white"> <div
class="bg-opacity-50 bg-gray-700 rounded p-2 text-white"
translate="no"
>
${renderNumber(other.gold() || 0)} ${renderNumber(other.gold() || 0)}
</div> </div>
</div> </div>
@@ -222,7 +225,10 @@ export class PlayerPanel extends LitElement implements Layer {
<div class="text-white text-opacity-80 text-sm px-2"> <div class="text-white text-opacity-80 text-sm px-2">
Troops Troops
</div> </div>
<div class="bg-opacity-50 bg-gray-700 rounded p-2 text-white"> <div
class="bg-opacity-50 bg-gray-700 rounded p-2 text-white"
translate="no"
>
${renderTroops(other.troops() || 0)} ${renderTroops(other.troops() || 0)}
</div> </div>
</div> </div>
+3 -2
View File
@@ -57,11 +57,12 @@ export class TopBar extends LitElement implements Layer {
class="sm:col-span-1 flex items-center space-x-1 overflow-x-auto whitespace-nowrap" class="sm:col-span-1 flex items-center space-x-1 overflow-x-auto whitespace-nowrap"
> >
<span class="font-bold shrink-0">Pop:</span> <span class="font-bold shrink-0">Pop:</span>
<span <span translate="no"
>${renderTroops(myPlayer.population())} / >${renderTroops(myPlayer.population())} /
${renderTroops(maxPop)}</span ${renderTroops(maxPop)}</span
> >
<span <span
translate="no"
class="${this._popRateIsIncreasing class="${this._popRateIsIncreasing
? "text-green-500" ? "text-green-500"
: "text-yellow-500"}" : "text-yellow-500"}"
@@ -73,7 +74,7 @@ export class TopBar extends LitElement implements Layer {
class="flex items-center space-x-2 overflow-x-auto whitespace-nowrap" class="flex items-center space-x-2 overflow-x-auto whitespace-nowrap"
> >
<span class="font-bold shrink-0">Gold:</span> <span class="font-bold shrink-0">Gold:</span>
<span <span translate="no"
>${renderNumber(myPlayer.gold())} >${renderNumber(myPlayer.gold())}
(+${renderNumber(goldPerSecond)})</span (+${renderNumber(goldPerSecond)})</span
> >