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 BattleScene from "../battle-scene";
import i18next from '../plugins/i18n';
export enum PokeballType { export enum PokeballType {
POKEBALL, POKEBALL,
@ -30,22 +31,22 @@ export function getPokeballName(type: PokeballType): string {
let ret: string; let ret: string;
switch (type) { switch (type) {
case PokeballType.POKEBALL: case PokeballType.POKEBALL:
ret = 'Poké Ball'; ret = i18next.t('pokeball:pokeBall');
break; break;
case PokeballType.GREAT_BALL: case PokeballType.GREAT_BALL:
ret = 'Great Ball'; ret = i18next.t('pokeball:greatBall');
break; break;
case PokeballType.ULTRA_BALL: case PokeballType.ULTRA_BALL:
ret = 'Ultra Ball'; ret = i18next.t('pokeball:ultraBall');
break; break;
case PokeballType.ROGUE_BALL: case PokeballType.ROGUE_BALL:
ret = 'Rogue Ball'; ret = i18next.t('pokeball:rogueBall');
break; break;
case PokeballType.MASTER_BALL: case PokeballType.MASTER_BALL:
ret = 'Master Ball'; ret = i18next.t('pokeball:masterBall');
break; break;
case PokeballType.LUXURY_BALL: case PokeballType.LUXURY_BALL:
ret = 'Luxury Ball'; ret = i18next.t('pokeball:luxuryBall');
break; break;
} }
return ret; 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 enMove } from '../locales/en/move';
import { move as frMove } from '../locales/fr/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 { export interface MoveTranslationEntry {
name: string, name: string,
effect: string effect: string
@ -50,6 +53,7 @@ export function initI18n(): void {
en: { en: {
menu: enMenu, menu: enMenu,
move: enMove, move: enMove,
pokeball: enPokeball,
}, },
it: { it: {
menu: itMenu, menu: itMenu,
@ -57,6 +61,7 @@ export function initI18n(): void {
fr: { fr: {
menu: frMenu, menu: frMenu,
move: frMove, move: frMove,
pokeball: frPokeball,
} }
}, },
}); });
@ -68,6 +73,7 @@ declare module 'i18next' {
resources: { resources: {
menu: typeof enMenu; menu: typeof enMenu;
move: typeof enMove; move: typeof enMove;
pokeball: typeof enPokeball;
}; };
} }
} }