mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-30 08:29:40 +00:00
Rename/fix: change Bots to Tribes (#3290)
## Description: Resolves #3285. As discussed on Discord. However, in at least one instance "Tribes" feels a bit off: in Humans vs Nations, team "Tribes" feels as human too while they are just bots. This PR changes Bots to Tribes outwardly by - Changing default EN translation. - Changing (untranslated) alt text in PlayerPanel. - To change "Team Bot" into "Team Tribes" too in PlayerInfoOverlay and TeamStats (team leaderboard in-game), translate team names in there from now on too. - This way we also fix a bug where team names were not translated yet in there. To add to that fix, also translate team names in LobbyPlayerView in the same way. For this we re-use the existing getTranslatedPlayerTeamLabel function from GameLeftSideBar by moving it to Utils. - No translation key was present yet for Humans and Nations teams, so added those to now be used in PlayerInfoOverlay, LobbyPlayerView and TeamStats for completeness. - No internal code changes so nothing breaks. **BEFORE (showing old team name Bot and also that team names weren't translated yet in TeamStats)**   **AFTER** (translations in Dutch only shown as proof here, did not include nl.json in the PR)      ## 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: tryout33
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
MessageType,
|
||||
PublicGameModifiers,
|
||||
Quads,
|
||||
Team,
|
||||
Trios,
|
||||
} from "../core/game/Game";
|
||||
import { GameConfig } from "../core/Schemas";
|
||||
@@ -408,6 +409,13 @@ export const translateText = (
|
||||
}
|
||||
};
|
||||
|
||||
export function getTranslatedPlayerTeamLabel(team: Team | null): string {
|
||||
if (!team) return "";
|
||||
const translationKey = `team_colors.${team.toLowerCase()}`;
|
||||
const translated = translateText(translationKey);
|
||||
return translated === translationKey ? team : translated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Severity colors mapping for message types
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user