mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 02:32:21 +02:00
Support for localization of regional form names
This commit is contained in:
parent
a941533a13
commit
102b4fa351
@ -690,6 +690,26 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the name of species with proper attachments for regionals and separate starter forms (Floette, Ursaluna)
|
||||||
|
* @param species the species to check
|
||||||
|
* @returns a string with the region name or other form name attached
|
||||||
|
*/
|
||||||
|
getExpandedSpeciesName(): string {
|
||||||
|
const name = this.name;
|
||||||
|
const region = this.getRegion();
|
||||||
|
if (this.speciesId === Species.ETERNAL_FLOETTE) {
|
||||||
|
return i18next.t("pokemonInfo:eternal_floette_expanded");
|
||||||
|
} else if (this.speciesId === Species.BLOODMOON_URSALUNA) {
|
||||||
|
return i18next.t("pokemonInfo:bloodmoon_ursaluna_expanded");
|
||||||
|
} else if (region === Region.NORMAL) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
const regionalName = i18next.t(`pokemonInfo:expandedName${Region[region]}`, { species: name });
|
||||||
|
return regionalName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
localize(): void {
|
localize(): void {
|
||||||
this.name = i18next.t(`pokemon:${Species[this.speciesId].toLowerCase()}`);
|
this.name = i18next.t(`pokemon:${Species[this.speciesId].toLowerCase()}`);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import { globalScene } from "#app/global-scene";
|
|||||||
import type { Egg } from "#app/data/egg";
|
import type { Egg } from "#app/data/egg";
|
||||||
import { EggCountChangedEvent } from "#app/events/egg";
|
import { EggCountChangedEvent } from "#app/events/egg";
|
||||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
|
||||||
import { Phase } from "#app/phase";
|
import { Phase } from "#app/phase";
|
||||||
import { achvs } from "#app/system/achv";
|
import { achvs } from "#app/system/achv";
|
||||||
import EggCounterContainer from "#app/ui/egg-counter-container";
|
import EggCounterContainer from "#app/ui/egg-counter-container";
|
||||||
@ -356,7 +355,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
|
|
||||||
globalScene.playSoundWithoutBgm("evolution_fanfare");
|
globalScene.playSoundWithoutBgm("evolution_fanfare");
|
||||||
|
|
||||||
globalScene.ui.showText(i18next.t("egg:hatchFromTheEgg", { pokemonName: getPokemonNameWithAffix(this.pokemon) }), null, () => {
|
globalScene.ui.showText(i18next.t("egg:hatchFromTheEgg", { pokemonName: this.pokemon.species.getExpandedSpeciesName() }), null, () => {
|
||||||
globalScene.gameData.updateSpeciesDexIvs(this.pokemon.species.speciesId, this.pokemon.ivs);
|
globalScene.gameData.updateSpeciesDexIvs(this.pokemon.species.speciesId, this.pokemon.ivs);
|
||||||
globalScene.gameData.setPokemonCaught(this.pokemon, true, true).then(() => {
|
globalScene.gameData.setPokemonCaught(this.pokemon, true, true).then(() => {
|
||||||
globalScene.gameData.setEggMoveUnlocked(this.pokemon.species, this.eggMoveIndex).then((value) => {
|
globalScene.gameData.setEggMoveUnlocked(this.pokemon.species, this.eggMoveIndex).then((value) => {
|
||||||
|
@ -918,18 +918,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the name of the region for regional species
|
|
||||||
* @param species the species to check
|
|
||||||
* @returns a string with the region name
|
|
||||||
*/
|
|
||||||
getRegionName(species: PokemonSpecies): string {
|
|
||||||
const name = species.name;
|
|
||||||
const label = Species[species.speciesId];
|
|
||||||
const suffix = label.includes("_") ? " (" + label.split("_")[0].toLowerCase() + ")" : "";
|
|
||||||
return name + suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processInput(button: Button): boolean {
|
||||||
if (this.blockInput) {
|
if (this.blockInput) {
|
||||||
return false;
|
return false;
|
||||||
@ -1372,7 +1360,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
options.push({
|
options.push({
|
||||||
label: pre.preFormKey ?
|
label: pre.preFormKey ?
|
||||||
this.getFormString(pre.preFormKey, preSpecies ?? this.species, true) :
|
this.getFormString(pre.preFormKey, preSpecies ?? this.species, true) :
|
||||||
this.getRegionName(preSpecies ?? this.species),
|
(preSpecies ?? this.species).getExpandedSpeciesName(),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
const newSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[pre.speciesId]);
|
const newSpecies = allSpecies.find(species => species.speciesId === pokemonPrevolutions[pre.speciesId]);
|
||||||
// Attempts to find the formIndex of the prevolved species
|
// Attempts to find the formIndex of the prevolved species
|
||||||
@ -1413,7 +1401,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
options.push({
|
options.push({
|
||||||
label: evo.evoFormKey ?
|
label: evo.evoFormKey ?
|
||||||
this.getFormString(evo.evoFormKey, evoSpecies ?? this.species, true) :
|
this.getFormString(evo.evoFormKey, evoSpecies ?? this.species, true) :
|
||||||
this.getRegionName(evoSpecies ?? this.species),
|
(evoSpecies ?? this.species).getExpandedSpeciesName(),
|
||||||
style: isCaughtEvo && isFormCaughtEvo ? TextStyle.WINDOW : TextStyle.SHADOW_TEXT,
|
style: isCaughtEvo && isFormCaughtEvo ? TextStyle.WINDOW : TextStyle.SHADOW_TEXT,
|
||||||
handler: () => {
|
handler: () => {
|
||||||
this.starterAttributes.form = newFormIndex;
|
this.starterAttributes.form = newFormIndex;
|
||||||
|
@ -160,7 +160,7 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
|
|||||||
this.pokemonCandyCountText.setVisible(true);
|
this.pokemonCandyCountText.setVisible(true);
|
||||||
|
|
||||||
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4));
|
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4));
|
||||||
this.pokemonNameText.setText(species.name);
|
this.pokemonNameText.setText(species.getExpandedSpeciesName());
|
||||||
|
|
||||||
const hasEggMoves = species && speciesEggMoves.hasOwnProperty(species.speciesId);
|
const hasEggMoves = species && speciesEggMoves.hasOwnProperty(species.speciesId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user