Added missing menu translations

This commit is contained in:
Raphael van der Woude 2024-04-30 12:52:52 +02:00
parent 14cc639654
commit acc062d7b6
3 changed files with 13 additions and 6 deletions

View File

@ -78,4 +78,9 @@ export const menu: SimpleTranslationEntries = {
"skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?",
"rankings": "Rankings",
"dailyRankings": "Daily Rankings",
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online"
} as const;

View File

@ -2,6 +2,7 @@ import BattleScene from "../battle-scene";
import { TextStyle, addTextObject } from "./text";
import { WindowVariant, addWindow } from "./ui-theme";
import * as Utils from "../utils";
import i18next from "i18next";
interface RankingEntry {
rank: integer,
@ -39,7 +40,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
const titleWindow = addWindow(this.scene, 0, 0, 114, 18, false, false, null, null, WindowVariant.THIN);
this.add(titleWindow);
this.titleLabel = addTextObject(this.scene, titleWindow.displayWidth / 2, titleWindow.displayHeight / 2, 'Daily Rankings', TextStyle.WINDOW, { fontSize: '64px' });
this.titleLabel = addTextObject(this.scene, titleWindow.displayWidth / 2, titleWindow.displayHeight / 2, i18next.t('menu:dailyRankings'), TextStyle.WINDOW, { fontSize: '64px' });
this.titleLabel.setOrigin(0.5, 0.5);
this.add(this.titleLabel);
@ -141,7 +142,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
update(category: ScoreboardCategory = this.category, page: integer = this.page) {
this.rankingsContainer.removeAll(true);
this.loadingLabel.setText('Loading…');
this.loadingLabel.setText(i18next.t('menu:loading'));
this.loadingLabel.setVisible(true);
if (category !== this.category)
@ -155,7 +156,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
.then(jsonResponse => {
this.page = page;
this.category = category;
this.titleLabel.setText(`${Utils.toReadableString(ScoreboardCategory[category])} Rankings`);
this.titleLabel.setText(`${Utils.toReadableString(ScoreboardCategory[category])} ${i18next.t("menu:rankings")}`);
this.prevPageButton.setAlpha(page > 1 ? 1 : 0.5);
this.nextPageButton.setAlpha(page < this.pageCount ? 1 : 0.5);
this.pageNumberLabel.setText(page.toString());
@ -163,7 +164,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.loadingLabel.setVisible(false);
this.updateRankings(jsonResponse);
} else
this.loadingLabel.setText('No Rankings');
this.loadingLabel.setText(i18next.t('menu:noRankings'));
});
});
}

View File

@ -5,6 +5,7 @@ import { Mode } from "./ui";
import * as Utils from "../utils";
import { TextStyle, addTextObject } from "./text";
import { battleCountSplashMessage, splashMessages } from "../data/splash-messages";
import i18next from "i18next";
export default class TitleUiHandler extends OptionSelectUiHandler {
private titleContainer: Phaser.GameObjects.Container;
@ -37,7 +38,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
this.titleContainer.add(this.dailyRunScoreboard);
this.playerCountLabel = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - 90, '? Players Online', TextStyle.MESSAGE, { fontSize: '54px' });
this.playerCountLabel = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - 90, `? ${i18next.t("menu:playersOnline")}`, TextStyle.MESSAGE, { fontSize: '54px' });
this.playerCountLabel.setOrigin(1, 0);
this.titleContainer.add(this.playerCountLabel);
@ -61,7 +62,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
Utils.apiFetch(`game/titlestats`)
.then(request => request.json())
.then(stats => {
this.playerCountLabel.setText(`${stats.playerCount} Players Online`);
this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`);
if (this.splashMessage === battleCountSplashMessage)
this.splashMessageText.setText(battleCountSplashMessage.replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
});