From 3c90427361499913bc12b428d93de6ae1b10a1e4 Mon Sep 17 00:00:00 2001 From: Juan-Lucas Date: Sun, 21 Apr 2024 12:18:09 +0200 Subject: [PATCH] pokeball: implement i18n on pokeball name and add french i18n --- src/data/pokeball.ts | 13 +++++++------ src/locales/en/pokeball.ts | 8 ++++++++ src/locales/fr/pokeball.ts | 8 ++++++++ src/plugins/i18n.ts | 6 ++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/locales/en/pokeball.ts create mode 100644 src/locales/fr/pokeball.ts diff --git a/src/data/pokeball.ts b/src/data/pokeball.ts index 45775f33d65..f5e39ba38ab 100644 --- a/src/data/pokeball.ts +++ b/src/data/pokeball.ts @@ -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; diff --git a/src/locales/en/pokeball.ts b/src/locales/en/pokeball.ts new file mode 100644 index 00000000000..6f774d416b9 --- /dev/null +++ b/src/locales/en/pokeball.ts @@ -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; \ No newline at end of file diff --git a/src/locales/fr/pokeball.ts b/src/locales/fr/pokeball.ts new file mode 100644 index 00000000000..0244550c5b2 --- /dev/null +++ b/src/locales/fr/pokeball.ts @@ -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; \ No newline at end of file diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 9a72ff55f9d..eabafd82c76 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -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; }; } }