diff --git a/resources/lang/en.json b/resources/lang/en.json index fab3cead6..9191490b4 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -43,6 +43,7 @@ "action_reset_gfx": "Reset graphics", "ui_section": "Game UI", "ui_leaderboard": "Leaderboard", + "ui_your_team": "Your team:", "ui_leaderboard_desc": "Shows the top players of the game and their names, % owned land, gold and troops. Using Show All shows all players in the game. If you don't want to see the leaderboard, click Hide.", "ui_control": "Control panel", "ui_control_desc": "The control panel contains the following elements:", @@ -203,6 +204,16 @@ "waiting": "Waiting for players...", "start": "Start Game" }, + "team_colors": { + "red": "Red", + "blue": "Blue", + "teal": "Teal", + "purple": "Purple", + "yellow": "Yellow", + "orange": "Orange", + "green": "Green", + "bot": "Bot" + }, "game_starting_modal": { "title": "Game is Starting...", "desc": "Preparing for the lobby to start. Please wait." @@ -392,9 +403,12 @@ "hide": "Hide", "rank": "Rank", "player": "Player", + "team": "Team", "owned": "Owned", "gold": "Gold", - "troops": "Troops" + "troops": "Troops", + "show_top_5": "Show Top 5", + "show_all": "Show All" }, "player_info_overlay": { "type": "Type", diff --git a/src/client/graphics/layers/GameLeftSidebar.ts b/src/client/graphics/layers/GameLeftSidebar.ts index 2f4bb2f6f..fc38ca1a4 100644 --- a/src/client/graphics/layers/GameLeftSidebar.ts +++ b/src/client/graphics/layers/GameLeftSidebar.ts @@ -3,6 +3,7 @@ import { html, LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; import { GameMode } from "../../../core/game/Game"; import { GameView } from "../../../core/game/GameView"; +import { translateText } from "../../Utils"; import "../icons/LeaderboardRegularIcon"; import "../icons/LeaderboardSolidIcon"; import "../icons/TeamRegularIcon"; @@ -66,6 +67,13 @@ export class GameLeftSidebar extends LitElement implements Layer { return this.game?.config().gameConfig().gameMode === GameMode.Team; } + private getTranslatedPlayerTeamLabel(): string { + if (!this.playerTeam) return ""; + const translationKey = `team_colors.${this.playerTeam.toLowerCase()}`; + const translated = translateText(translationKey); + return translated === translationKey ? this.playerTeam : translated; + } + render() { return html`