pokeball: implement i18n on pokeball name and add french i18n

pull/225/head
Juan-Lucas 2024-04-21 12:18:09 +02:00 committed by Samuel H
parent c8a9069e8b
commit 3c90427361
4 changed files with 29 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import BattleScene from "../battle-scene";
import i18next from '../plugins/i18n';
export enum PokeballType {
POKEBALL,
@ -30,22 +31,22 @@ export function getPokeballName(type: PokeballType): string {
let ret: string;
switch (type) {
case PokeballType.POKEBALL:
ret = 'Poké Ball';
ret = i18next.t('pokeball:pokeBall');
break;
case PokeballType.GREAT_BALL:
ret = 'Great Ball';
ret = i18next.t('pokeball:greatBall');
break;
case PokeballType.ULTRA_BALL:
ret = 'Ultra Ball';
ret = i18next.t('pokeball:ultraBall');
break;
case PokeballType.ROGUE_BALL:
ret = 'Rogue Ball';
ret = i18next.t('pokeball:rogueBall');
break;
case PokeballType.MASTER_BALL:
ret = 'Master Ball';
ret = i18next.t('pokeball:masterBall');
break;
case PokeballType.LUXURY_BALL:
ret = 'Luxury Ball';
ret = i18next.t('pokeball:luxuryBall');
break;
}
return ret;

View File

@ -0,0 +1,8 @@
export const pokeball = {
"pokeBall": "Poké Ball",
"greatBall": "Great Ball",
"ultraBall": "Ultra Ball",
"rogueBall": "Rogue Ball",
"masterBall": "Master Ball",
"luxuryBall": "Luxury Ball",
} as const;

View File

@ -0,0 +1,8 @@
export const pokeball = {
"pokeBall": "Poké Ball",
"greatBall": "Super Ball",
"ultraBall": "Hyper Ball",
"rogueBall": "Rogue Ball",
"masterBall": "Master Ball",
"luxuryBall": "Luxe Ball",
} as const;

View File

@ -6,6 +6,9 @@ import { menu as frMenu } from '../locales/fr/menu';
import { move as enMove } from '../locales/en/move';
import { move as frMove } from '../locales/fr/move';
import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as frPokeball } from '../locales/fr/pokeball';
export interface MoveTranslationEntry {
name: string,
effect: string
@ -50,6 +53,7 @@ export function initI18n(): void {
en: {
menu: enMenu,
move: enMove,
pokeball: enPokeball,
},
it: {
menu: itMenu,
@ -57,6 +61,7 @@ export function initI18n(): void {
fr: {
menu: frMenu,
move: frMove,
pokeball: frPokeball,
}
},
});
@ -68,6 +73,7 @@ declare module 'i18next' {
resources: {
menu: typeof enMenu;
move: typeof enMove;
pokeball: typeof enPokeball;
};
}
}