diff --git a/src/data/egg.ts b/src/data/egg.ts index f0d6de26abb..d069d8cfeee 100644 --- a/src/data/egg.ts +++ b/src/data/egg.ts @@ -1,9 +1,9 @@ -import { Type } from "./type"; -import * as Utils from "../utils"; import BattleScene from "../battle-scene"; +import i18next from '../plugins/i18n'; +import * as Utils from "../utils"; +import { EggTier } from "./enums/egg-type"; import { Species } from "./enums/species"; import { getPokemonSpecies, speciesStarters } from "./pokemon-species"; -import { EggTier } from "./enums/egg-type"; export const EGG_SEED = 1073741824; @@ -54,36 +54,53 @@ export function getEggTierDefaultHatchWaves(tier: EggTier): integer { export function getEggDescriptor(egg: Egg): string { if (egg.isManaphyEgg()) return 'Manaphy'; + let ret: string; switch (egg.tier) { case EggTier.GREAT: - return 'Rare'; + ret = i18next.t('eggList:rare'); + return ret; case EggTier.ULTRA: - return 'Epic'; + ret = i18next.t('eggList:epic'); + return ret; case EggTier.MASTER: - return 'Legendary'; + ret = i18next.t('eggList:legendary'); + return ret; default: - return 'Common'; + ret = i18next.t('eggList:common'); + return ret; } } export function getEggHatchWavesMessage(hatchWaves: integer): string { - if (hatchWaves <= 5) - return 'Sounds can be heard coming from inside! It will hatch soon!'; - if (hatchWaves <= 15) - return 'It appears to move occasionally. It may be close to hatching.'; - if (hatchWaves <= 50) - return 'What will hatch from this? It doesn\'t seem close to hatching.'; - return 'It looks like this Egg will take a long time to hatch.'; + let ret: string; + switch (true) { + case hatchWaves <= 5: + ret = i18next.t('eggList:5waves'); + return ret; + case hatchWaves <= 15: + ret = i18next.t('eggList:15waves'); + return ret; + case hatchWaves <= 50: + ret = i18next.t('eggList:50waves'); + return ret; + default: + ret = i18next.t('eggList:>50waves'); + return ret; + } } export function getEggGachaTypeDescriptor(scene: BattleScene, egg: Egg): string { + let ret: string; switch (egg.gachaType) { case GachaType.LEGENDARY: - return `Legendary Rate Up (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})`; + ret = `${i18next.t('eggList:legendaryRateUp')} (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, egg.timestamp)).getName()})` + return ret; case GachaType.MOVE: - return 'Rare Egg Move Rate Up'; + ret = i18next.t('eggList:rareEggMoveRateUp'); + return ret; case GachaType.SHINY: - return 'Shiny Rate Up'; + ret = i18next.t('eggList:shinyRateUp'); + return ret; } } diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 2cc7a52c8f1..cc3d91e5274 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -18,6 +19,7 @@ export const deConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/de/egg-list.ts b/src/locales/de/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/de/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 029791a701c..4671a1b6a6a 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -18,6 +19,7 @@ export const enConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/en/egg-list.ts b/src/locales/en/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/en/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index 564b8dd320d..ea67bb208be 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -18,6 +19,7 @@ export const esConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/es/egg-list.ts b/src/locales/es/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/es/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 90f9fb83c53..98a4fb31e3b 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -18,6 +19,7 @@ export const frConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/fr/egg-list.ts b/src/locales/fr/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/fr/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index bbfd452dc39..50fa3483c5a 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -18,6 +19,7 @@ export const itConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/it/egg-list.ts b/src/locales/it/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/it/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/locales/pt_BR/config.ts b/src/locales/pt_BR/config.ts index fc58d45ce87..05b9913801a 100644 --- a/src/locales/pt_BR/config.ts +++ b/src/locales/pt_BR/config.ts @@ -1,6 +1,7 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -13,11 +14,11 @@ import { pokemonStat } from "./pokemon-stat"; import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { tutorial } from "./tutorial"; - export const ptBrConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/pt_BR/egg-list.ts b/src/locales/pt_BR/egg-list.ts new file mode 100644 index 00000000000..2d50fddbcc8 --- /dev/null +++ b/src/locales/pt_BR/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Ovo", + "common": "Comum", + "rare": "Raro", + "epic": "Épico", + "legendary": "Lendário", + "5waves": "Barulhos podem ser ouvidos vindo de dentro! Vai chocar em breve!", + "15waves": "Parece se mover ocasionalmente. Pode estar perto de chocar.", + "50waves": "O que vai nascer disso? Não parece estar perto de chocar.", + ">50waves": "Parece que este ovo vai demorar bastante para chocar.", + "legendaryRateUp": "Taxa de Lendário Aumentada", + "rareEggMoveRateUp": "Taxa de Movimento de Ovo Raro Aumentada", + "shinyRateUp": "Taxa de Shiny Aumentada", +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index a8f5f878ba0..00271948d18 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -1,22 +1,24 @@ import { ability } from "./ability"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; +import { eggList } from "./egg-list"; import { fightUiHandler } from "./fight-ui-handler"; import { menu } from "./menu"; import { menuUiHandler } from "./menu-ui-handler"; import { move } from "./move"; +import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonStat } from "./pokemon-stat"; import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { tutorial } from "./tutorial"; -import { nature } from "./nature"; export const zhCnConfig = { ability: ability, battle: battle, commandUiHandler: commandUiHandler, + eggList: eggList, fightUiHandler: fightUiHandler, menuUiHandler: menuUiHandler, menu: menu, diff --git a/src/locales/zh_CN/egg-list.ts b/src/locales/zh_CN/egg-list.ts new file mode 100644 index 00000000000..791298ab4c6 --- /dev/null +++ b/src/locales/zh_CN/egg-list.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const eggList: SimpleTranslationEntries = { + "egg": "Egg", + "common": "Common", + "rare": "Rare", + "epic": "Epic", + "legendary": "Legendary", + "5waves": "Sounds can be heard coming from inside! It will hatch soon!", + "15waves": "It appears to move occasionally. It may be close to hatching.", + "50waves": "What will hatch from this? It doesn't seem close to hatching.", + ">50waves": "It looks like this Egg will take a long time to hatch.", + "legendaryRateUp": "Legendary Rate Up", + "rareEggMoveRateUp": "Rare Egg Move Rate Up", + "shinyRateUp": "Shiny Rate Up", +} as const; \ No newline at end of file diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 676e691ee29..722b3e9ee34 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -109,6 +109,7 @@ declare module 'i18next' { starterSelectUiHandler: SimpleTranslationEntries; nature: SimpleTranslationEntries; growth: SimpleTranslationEntries; + eggList: SimpleTranslationEntries; }; } } diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index edeac7d71c7..602afa3e7f8 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -1,12 +1,12 @@ import BattleScene from "../battle-scene"; -import { Mode } from "./ui"; +import { Egg, getEggDescriptor, getEggGachaTypeDescriptor, getEggHatchWavesMessage } from "../data/egg"; +import { Button } from "../enums/buttons"; +import i18next from '../plugins/i18n'; +import MessageUiHandler from "./message-ui-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "./pokemon-icon-anim-handler"; import { TextStyle, addTextObject } from "./text"; -import MessageUiHandler from "./message-ui-handler"; -import { EGG_SEED, Egg, GachaType, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from "../data/egg"; -import * as Utils from "../utils"; +import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; -import {Button} from "../enums/buttons"; export default class EggListUiHandler extends MessageUiHandler { private eggListContainer: Phaser.GameObjects.Container; @@ -165,7 +165,7 @@ export default class EggListUiHandler extends MessageUiHandler { setEggDetails(egg: Egg): void { this.eggSprite.setFrame(`egg_${egg.getKey()}`); - this.eggNameText.setText(`Egg (${getEggDescriptor(egg)})`); + this.eggNameText.setText(`${i18next.t('eggList:egg')} (${getEggDescriptor(egg)})`); this.eggDateText.setText( new Date(egg.timestamp).toLocaleString(undefined, { weekday: 'short',