Locales for Voucher names + Voucher rewards (#1137)

* Update voucher.ts

* Update vouchers-ui-handler.ts

* Update i18n.ts

* Update config.ts

* Update config.ts

* Update config.ts

* Update config.ts

* Update config.ts

* Update config.ts

* Update config.ts

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
This commit is contained in:
Lugiad 2024-05-20 00:25:52 +02:00 committed by GitHub
parent 13f2cafe5e
commit 7216990d87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 118 additions and 19 deletions

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const deConfig = {
ability: ability,
@ -46,4 +47,5 @@ export const deConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

11
src/locales/de/voucher.ts Normal file
View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const enConfig = {
ability: ability,
@ -46,4 +47,5 @@ export const enConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

11
src/locales/en/voucher.ts Normal file
View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const esConfig = {
ability: ability,
@ -46,4 +47,5 @@ export const esConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

11
src/locales/es/voucher.ts Normal file
View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const frConfig = {
ability: ability,
@ -46,4 +47,5 @@ export const frConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

11
src/locales/fr/voucher.ts Normal file
View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Coupons",
"eggVoucher": "Coupon Œuf",
"eggVoucherPlus": "Coupon Œuf +",
"eggVoucherPremium": "Coupon Œuf Premium",
"eggVoucherGold": "Coupon Œuf Or",
"locked": "Verrouillé",
"defeatTrainer": "Vaincre {{trainerName}}"
} as const;

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const itConfig = {
ability: ability,
@ -46,4 +47,5 @@ export const itConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

11
src/locales/it/voucher.ts Normal file
View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -19,6 +19,7 @@ import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const ptBrConfig = {
@ -45,4 +46,5 @@ export const ptBrConfig = {
weather: weather,
modifierType: modifierType,
berry: berry,
voucher: voucher,
}

View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -20,6 +20,7 @@ import { tutorial } from "./tutorial";
import { weather } from "./weather";
import { battleMessageUiHandler } from "./battle-message-ui-handler";
import { berry } from "./berry";
import { voucher } from "./voucher";
export const zhCnConfig = {
@ -47,4 +48,5 @@ export const zhCnConfig = {
weather: weather,
battleMessageUiHandler: battleMessageUiHandler,
berry: berry,
voucher: voucher,
}

View File

@ -0,0 +1,11 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const voucher: SimpleTranslationEntries = {
"vouchers": "Vouchers",
"eggVoucher": "Egg Voucher",
"eggVoucherPlus": "Egg Voucher Plus",
"eggVoucherPremium": "Egg Voucher Premium",
"eggVoucherGold": "Egg Voucher Gold",
"locked": "Locked",
"defeatTrainer": "Defeat {{trainerName}}"
} as const;

View File

@ -153,6 +153,7 @@ declare module 'i18next' {
modifierType: ModifierTypeTranslationEntries;
battleMessageUiHandler: SimpleTranslationEntries;
berry: BerryTranslationEntries;
voucher: SimpleTranslationEntries;
};
}
}

View File

@ -2,6 +2,7 @@ import BattleScene from "../battle-scene";
import { TrainerType } from "../data/enums/trainer-type";
import { ModifierTier } from "../modifier/modifier-tier";
import { Achv, AchvTier, achvs } from "./achv";
import i18next from '../plugins/i18n';
export enum VoucherType {
REGULAR,
@ -52,13 +53,13 @@ export class Voucher {
export function getVoucherTypeName(voucherType: VoucherType): string {
switch (voucherType) {
case VoucherType.REGULAR:
return 'Egg Voucher';
return i18next.t("voucher:eggVoucher");
case VoucherType.PLUS:
return 'Egg Voucher Plus';
return i18next.t("voucher:eggVoucherPlus");
case VoucherType.PREMIUM:
return 'Egg Voucher Premium';
return i18next.t("voucher:eggVoucherPremium");
case VoucherType.GOLDEN:
return 'Egg Voucher Gold';
return i18next.t("voucher:eggVoucherGold");
}
}
@ -75,9 +76,8 @@ export function getVoucherTypeIcon(voucherType: VoucherType): string {
}
}
export interface Vouchers {
[key: string]: Voucher
[key: string]: Voucher;
}
export const vouchers: Vouchers = {};
@ -87,6 +87,8 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
{
(function() {
import('../data/trainer-config').then(tc => {
const trainerConfigs = tc.trainerConfigs;
for (let achv of voucherAchvs) {
const voucherType = achv.score >= 150
? VoucherType.GOLDEN
@ -98,7 +100,6 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
vouchers[achv.id] = new Voucher(voucherType, achv.description);
}
const trainerConfigs = tc.trainerConfigs;
const bossTrainerTypes = Object.keys(trainerConfigs)
.filter(tt => trainerConfigs[tt].isBoss && trainerConfigs[tt].getDerivedType() !== TrainerType.RIVAL);
@ -107,12 +108,17 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ];
? VoucherType.PLUS
: VoucherType.PREMIUM;
const key = TrainerType[trainerType];
vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`);
const trainerName = trainerConfigs[trainerType].name;
vouchers[key] = new Voucher(
voucherType,
i18next.t("voucher:defeatTrainer", { trainerName })
);
}
const voucherKeys = Object.keys(vouchers);
for (let k of voucherKeys)
for (let k of voucherKeys) {
vouchers[k].id = k;
}
});
})();
}

View File

@ -5,6 +5,7 @@ import { TextStyle, addTextObject } from "./text";
import { Mode } from "./ui";
import { addWindow } from "./ui-theme";
import {Button} from "../enums/buttons";
import i18next from '../plugins/i18n';
const itemRows = 4;
const itemCols = 17;
@ -40,7 +41,7 @@ export default class VouchersUiHandler extends MessageUiHandler {
const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24);
headerBg.setOrigin(0, 0);
const headerText = addTextObject(this.scene, 0, 0, 'Vouchers', TextStyle.SETTINGS_LABEL);
const headerText = addTextObject(this.scene, 0, 0, i18next.t("voucher:vouchers"), TextStyle.SETTINGS_LABEL);
headerText.setOrigin(0, 0);
headerText.setPositionRelative(headerBg, 8, 4);
@ -127,7 +128,7 @@ export default class VouchersUiHandler extends MessageUiHandler {
this.titleText.setText(getVoucherTypeName(voucher.voucherType));
this.showText(voucher.description);
this.unlockText.setText(unlocked ? new Date(voucherUnlocks[voucher.id]).toLocaleDateString() : 'Locked');
this.unlockText.setText(unlocked ? new Date(voucherUnlocks[voucher.id]).toLocaleDateString() : i18next.t("voucher:locked"));
}
processInput(button: Button): boolean {