From cd68d2c4a9abc13e898b04397b40fef66cb86c31 Mon Sep 17 00:00:00 2001 From: PabloG02 Date: Wed, 24 Apr 2024 01:19:36 +0200 Subject: [PATCH] Make more phases strings translatable and add their spanish locale --- src/locales/en/menu.ts | 19 +++++++++++++++++ src/locales/es/menu.ts | 23 +++++++++++++++++++-- src/phases.ts | 46 +++++++++++++++++++++--------------------- 3 files changed, 63 insertions(+), 25 deletions(-) diff --git a/src/locales/en/menu.ts b/src/locales/en/menu.ts index 22610268ad1..c666f0b5d1b 100644 --- a/src/locales/en/menu.ts +++ b/src/locales/en/menu.ts @@ -44,8 +44,22 @@ export const menu: SimpleTranslationEntries = { "playerGo": "Go! {{pokemonName}}!", "trainerGo": "{{trainerName}} sent out {{pokemonName}}!", "switchQuestion": "Will you switch\n{{pokemonName}}?", + "trainerDefeated": `You defeated\n{{trainerName}}!`, + "pokemonCaught": "{{pokemonName}} was caught!", "pokemon": "Pokémon", "sendOutPokemon": "Go! {{pokemonName}}!", + "attackFailed": "But it failed!", + "attackHitsCount": `Hit {{hitsTotal}} time(s)!`, + "expGain": "{{pokemonName}} gained\n{{exp}} EXP. Points!", + "levelUp": "{{pokemonName}} grew to\nLv. {{level}}!", + "learnMove": "{{pokemonName}} learned\n{{moveName}}!", + "learnMovePrompt": "{{pokemonName}} wants to learn the\nmove {{moveName}}.", + "learnMoveLimitReached": "However, {{pokemonName}} already\nknows four moves.", + "learnMoveReplaceQuestion": "Should a move be forgotten and\nreplaced with {{moveName}}?", + "learnMoveStopTeaching": "Stop trying to teach\n{{moveName}}?", + "learnMoveNotLearned": "{{pokemonName}} did not learn the\nmove {{moveName}}.", + "learnMoveForgetQuestion": "Which move should be forgotten?", + "learnMoveForgetSuccess": "{{pokemonName}} forgot how to\nuse {{moveName}}.", "levelCapUp": "The level cap\nhas increased to {{levelCap}}!", "moveNotImplemented": "{{moveName}} is not yet implemented and cannot be selected.", "moveDisabled": "{{moveName}} is disabled!", @@ -56,7 +70,12 @@ export const menu: SimpleTranslationEntries = { "noEscapeForce": "An unseen force\nprevents escape.", "noEscapeTrainer": "You can't run\nfrom a trainer battle!", "noEscapePokemon": "{{pokemonName}}'s {{moveName}}\nprevents {{escapeVerb}}!", + "runAwaySuccess": "You got away safely!", + "runAwayCannotEscape": 'You can\'t escape!', "escapeVerbSwitch": "switching", "escapeVerbFlee": "fleeing", "notDisabled": "{{moveName}} is disabled\nno more!", + "skipItemQuestion": "Are you sure you want to skip taking an item?", + "eggHatching": "Oh?", + "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?", } as const; \ No newline at end of file diff --git a/src/locales/es/menu.ts b/src/locales/es/menu.ts index 734219f2a16..f9ee86a1b10 100644 --- a/src/locales/es/menu.ts +++ b/src/locales/es/menu.ts @@ -20,7 +20,7 @@ export const menu: SimpleTranslationEntries = { "boy": "Chico", "girl": "Chica", "bossAppeared": "¡{{bossName}} te corta el paso!", - "trainerAppeared": "¡{{trainerName}}\n te desafía!", + "trainerAppeared": "¡{{trainerName}}\nte desafía!", "singleWildAppeared": "¡Un {{pokemonName}} salvaje te corta el paso!", "multiWildAppeared": "¡Un {{pokemonName1}} y un {{pokemonName2}} salvajes\nte cortan el paso!", "playerComeBack": "¡{{pokemonName}}, ven aquí!", @@ -28,8 +28,22 @@ export const menu: SimpleTranslationEntries = { "playerGo": "¡Adelante, {{pokemonName}}!", "trainerGo": "¡{{trainerName}} saca a {{pokemonName}}!", "switchQuestion": "¿Quieres cambiar a\n{{pokemonName}}?", + "trainerDefeated": "¡Has derrotado a\n{{trainerName}}!", + "pokemonCaught": "¡{{pokemonName}} atrapado!", "pokemon": "Pokémon", "sendOutPokemon": "¡Adelante, {{pokemonName}}!", + "attackFailed": "¡Pero ha fallado!", + "attackHitsCount": `N.º de golpes: {{hitsTotal}}.`, + "expGain": "{{pokemonName}} ha ganado\n{{exp}} puntos de experiencia.", + "levelUp": "¡{{pokemonName}} ha subido al \nNv. {{level}}!", + "learnMove": "¡{{pokemonName}} ha aprendido {{moveName}}!", + "learnMovePrompt": "{{pokemonName}} quiere aprender {{moveName}}.", + "learnMoveLimitReached": "Pero, {{pokemonName}} ya conoce\ncuatro movimientos.", + "learnMoveReplaceQuestion": "¿Quieres sustituir uno de sus movimientos por {{moveName}}?", + "learnMoveStopTeaching": "¿Prefieres que no aprenda\n{{moveName}}?", + "learnMoveNotLearned": "{{pokemonName}} no ha aprendido {{moveName}}.", + "learnMoveForgetQuestion": "¿Qué movimiento quieres que olvide?", + "learnMoveForgetSuccess": "{{pokemonName}} ha olvidado cómo utilizar {{moveName}}.", "levelCapUp": "¡Se ha incrementado el\nnivel máximo a {{levelCap}}!", "moveNotImplemented": "{{moveName}} aún no está implementado y no se puede seleccionar.", "moveDisabled": "!No puede usar {{moveName}} porque ha sido anulado!", @@ -40,7 +54,12 @@ export const menu: SimpleTranslationEntries = { "noEscapeForce": "Una fuerza misteriosa\nte impide huir.", "noEscapeTrainer": "¡No puedes huir de los\ncombates contra Entrenadores!", "noEscapePokemon": "¡El movimiento {{moveName}} de {{pokemonName}} impide la huida!", + "runAwaySuccess": "¡Escapas sin problemas!", + "runAwayCannotEscape": "¡No has podido escapar!", "escapeVerbSwitch": "cambiar", "escapeVerbFlee": "huir", - "notDisabled": "¡El movimiento {{moveName}}\n ya no está anulado!", + "notDisabled": "¡El movimiento {{moveName}}\nya no está anulado!", + "skipItemQuestion": "¿Estás seguro de que no quieres coger un objeto?", + "eggHatching": "¿Y esto?", + "ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?" } as const; \ No newline at end of file diff --git a/src/phases.ts b/src/phases.ts index ad4f52e55a0..535a6c2b2c3 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1185,7 +1185,7 @@ export class SummonPhase extends PartyMemberPokemonPhase { } if (this.player) { - this.scene.ui.showText(i18next.t('menu:playerGo', {pokemonName: this.getPokemon().name})); + this.scene.ui.showText(i18next.t('menu:playerGo', { pokemonName: this.getPokemon().name })); if (this.player) this.scene.pbTray.hide(); this.scene.trainer.setTexture(`trainer_${this.scene.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back_pb`); @@ -2335,7 +2335,7 @@ export class MovePhase extends BattlePhase { } showFailedText(failedText: string = null): void { - this.scene.queueMessage(failedText || 'But it failed!'); + this.scene.queueMessage(failedText || i18next.t('menu:attackFailed')); } end() { @@ -2398,7 +2398,7 @@ export class MoveEffectPhase extends PokemonPhase { moveHistoryEntry.result = MoveResult.MISS; applyMoveAttrs(MissEffectAttr, user, null, this.move.getMove()); } else { - this.scene.queueMessage('But it failed!'); + this.scene.queueMessage(i18next.t('menu:attackFailed')); moveHistoryEntry.result = MoveResult.FAIL; } return this.end(); @@ -2482,7 +2482,7 @@ export class MoveEffectPhase extends PokemonPhase { else { const hitsTotal = user.turnData.hitCount - Math.max(user.turnData.hitsLeft, 0); if (hitsTotal > 1) - this.scene.queueMessage(`Hit ${hitsTotal} time(s)!`); + this.scene.queueMessage(i18next.t('menu:attackHitsCount', { count: hitsTotal })); this.scene.applyModifiers(HitHealModifier, this.player, user); } } @@ -2677,7 +2677,7 @@ export class StatChangePhase extends PokemonPhase { if (!pokemon.isActive(true)) return this.end(); - + const filteredStats = this.stats.map(s => s !== BattleStat.RAND ? s : this.getRandomStat()).filter(stat => { const cancelled = new Utils.BooleanHolder(false); @@ -2777,7 +2777,7 @@ export class StatChangePhase extends PokemonPhase { continue; } this.levels += existingPhase.levels; - + if (!this.scene.tryRemovePhase(p => p === existingPhase)) break; } @@ -3336,7 +3336,7 @@ export class TrainerVictoryPhase extends BattlePhase { this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.VOUCHER)); } - this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName(TrainerSlot.NONE, true)}!`, null, () => { + this.scene.ui.showText(i18next.t('menu:trainerDefeated', { trainerName: this.scene.currentBattle.trainer.getName(TrainerSlot.NONE, true) }), null, () => { const victoryMessages = this.scene.currentBattle.trainer.getVictoryMessages(); const showMessage = () => { let message: string; @@ -3603,7 +3603,7 @@ export class ExpPhase extends PlayerPartyMemberPokemonPhase { let exp = new Utils.NumberHolder(this.expValue); this.scene.applyModifiers(ExpBoosterModifier, true, exp); exp.value = Math.floor(exp.value); - this.scene.ui.showText(`${pokemon.name} gained\n${exp.value} EXP. Points!`, null, () => { + this.scene.ui.showText(i18next.t('menu:expGain', { pokemonName: pokemon.name, exp: exp.value }), null, () => { const lastLevel = pokemon.level; let newLevel: integer; pokemon.addExp(exp.value); @@ -3691,7 +3691,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase { pokemon.calculateStats(); pokemon.updateInfo(); this.scene.playSound('level_up_fanfare'); - this.scene.ui.showText(`${this.getPokemon().name} grew to\nLv. ${this.level}!`, null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(this.partyMemberIndex, prevStats, false).then(() => this.end()), null, true); + this.scene.ui.showText(i18next.t('menu:levelUp', { pokemonName: this.getPokemon().name, level: this.level }), null, () => this.scene.ui.getMessageHandler().promptLevelUpStats(this.partyMemberIndex, prevStats, false).then(() => this.end()), null, true); if (this.level <= 100) { const levelMoves = this.getPokemon().getLevelMoves(this.lastLevel + 1); for (let lm of levelMoves) @@ -3740,7 +3740,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { .then(() => { this.scene.ui.setMode(messageMode).then(() => { this.scene.playSound('level_up_fanfare'); - this.scene.ui.showText(`${pokemon.name} learned\n${move.name}!`, null, () => { + this.scene.ui.showText(i18next.t('menu:learnMove', { pokemonName: pokemon.name, moveName: move.name }), null, () => { this.scene.triggerPokemonFormChange(pokemon, SpeciesFormChangeMoveLearnedTrigger, true); this.end(); }, messageMode === Mode.EVOLUTION_SCENE ? 1000 : null, true); @@ -3749,15 +3749,15 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { }); } else { this.scene.ui.setMode(messageMode).then(() => { - this.scene.ui.showText(`${pokemon.name} wants to learn the\nmove ${move.name}.`, null, () => { - this.scene.ui.showText(`However, ${pokemon.name} already\nknows four moves.`, null, () => { - this.scene.ui.showText(`Should a move be deleted and\nreplaced with ${move.name}?`, null, () => { + this.scene.ui.showText(i18next.t('menu:learnMovePrompt', { pokemonName: pokemon.name, moveName: move.name }), null, () => { + this.scene.ui.showText(i18next.t('menu:learnMoveLimitReached', { pokemonName: pokemon.name }), null, () => { + this.scene.ui.showText(i18next.t('menu:learnMoveReplaceQuestion', { moveName: move.name }), null, () => { const noHandler = () => { this.scene.ui.setMode(messageMode).then(() => { - this.scene.ui.showText(`Stop trying to teach\n${move.name}?`, null, () => { + this.scene.ui.showText(i18next.t('menu:learnMoveStopTeaching', { moveName: move.name }), null, () => { this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => { this.scene.ui.setMode(messageMode); - this.scene.ui.showText(`${pokemon.name} did not learn the\nmove ${move.name}.`, null, () => this.end(), null, true); + this.scene.ui.showText(i18next.t('menu:learnMoveNotLearned', { pokemonName: pokemon.name, moveName: move.name }), null, () => this.end(), null, true); }, () => { this.scene.ui.setMode(messageMode); this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, this.moveId)); @@ -3768,7 +3768,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { }; this.scene.ui.setModeWithoutClear(Mode.CONFIRM, () => { this.scene.ui.setMode(messageMode); - this.scene.ui.showText('Which move should be forgotten?', null, () => { + this.scene.ui.showText(i18next.t('menu:learnMoveForgetQuestion'), null, () => { this.scene.ui.setModeWithoutClear(Mode.SUMMARY, this.getPokemon(), SummaryUiMode.LEARN_MOVE, move, (moveIndex: integer) => { if (moveIndex === 4) { noHandler(); @@ -3776,7 +3776,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { } this.scene.ui.setMode(messageMode).then(() => { this.scene.ui.showText('@d{32}1, @d{15}2, and@d{15}… @d{15}… @d{15}… @d{15}@s{pb_bounce_1}Poof!', null, () => { - this.scene.ui.showText(`${pokemon.name} forgot how to\nuse ${pokemon.moveset[moveIndex].getName()}.`, null, () => { + this.scene.ui.showText(i18next.t('menu:learnMoveForgetSuccess', { pokemonName: pokemon.name, moveName: pokemon.moveset[moveIndex].getName() }), null, () => { this.scene.ui.showText('And…', null, () => { pokemon.setMove(moveIndex, Moves.NONE); this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, this.moveId)); @@ -4091,7 +4091,7 @@ export class AttemptCapturePhase extends PokemonPhase { this.scene.gameData.updateSpeciesDexIvs(pokemon.species.speciesId, pokemon.ivs); - this.scene.ui.showText(`${pokemon.name} was caught!`, null, () => { + this.scene.ui.showText(i18next.t('menu:pokemonCaught', { pokemonName: pokemon.name }), null, () => { const end = () => { this.scene.pokemonInfoContainer.hide(); this.removePb(); @@ -4177,7 +4177,7 @@ export class AttemptRunPhase extends PokemonPhase { if (playerPokemon.randSeedInt(256) < escapeChance.value) { this.scene.playSound('flee'); - this.scene.queueMessage('You got away safely!', null, true, 500); + this.scene.queueMessage(i18next.t('menu:runAwaySuccess'), null, true, 500); this.scene.tweens.add({ targets: [ this.scene.arenaEnemy, enemyField ].flat(), @@ -4198,7 +4198,7 @@ export class AttemptRunPhase extends PokemonPhase { this.scene.pushPhase(new BattleEndPhase(this.scene)); this.scene.pushPhase(new NewBattlePhase(this.scene)); } else - this.scene.queueMessage('You can\'t escape!', null, true); + this.scene.queueMessage(i18next.t('menu:runAwayCannotEscape'), null, true, 500); this.end(); } @@ -4230,7 +4230,7 @@ export class SelectModifierPhase extends BattlePhase { const modifierSelectCallback = (rowCursor: integer, cursor: integer) => { if (rowCursor < 0 || cursor < 0) { - this.scene.ui.showText(`Are you sure you want to skip taking an item?`, null, () => { + this.scene.ui.showText(i18next.t('menu:skipItemQuestion'), null, () => { this.scene.ui.setOverlayMode(Mode.CONFIRM, () => { this.scene.ui.revertMode(); this.scene.ui.setMode(Mode.MESSAGE); @@ -4408,7 +4408,7 @@ export class EggLapsePhase extends Phase { }); if (eggsToHatch.length) { - this.scene.queueMessage('Oh?'); + this.scene.queueMessage(i18next.t('menu:eggHatching')); for (let egg of eggsToHatch) this.scene.unshiftPhase(new EggHatchPhase(this.scene, egg)); @@ -4502,7 +4502,7 @@ export class ScanIvsPhase extends PokemonPhase { const pokemon = this.getPokemon(); - this.scene.ui.showText(`Use IV Scanner on ${pokemon.name}?`, null, () => { + this.scene.ui.showText(i18next.t('menu:ivScannerUseQuestion', { pokemonName: pokemon.name }), null, () => { this.scene.ui.setMode(Mode.CONFIRM, () => { this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.clearText();