This commit is contained in:
AJ Fontaine 2025-02-11 15:27:20 -05:00
parent ab343e559a
commit 0ffd2cbf26

View File

@ -695,17 +695,10 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
* @returns a string with the region name or other form name attached * @returns a string with the region name or other form name attached
*/ */
getExpandedSpeciesName(): string { getExpandedSpeciesName(): string {
const name = this.name; if (this.speciesId < 2000) {
const region = this.getRegion(); return this.name; // Other special cases could be put here too
if (this.speciesId === Species.ETERNAL_FLOETTE) { } else { // Everything beyond this point essentially follows the pattern of FORMNAME_SPECIES
return i18next.t("pokemonInfo:eternal_floette_expanded"); return i18next.t(`pokemonForm:appendForm.${Species[this.speciesId].split("_")[0]}`, { species: this.name });
} 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;
} }
} }
@ -725,8 +718,8 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
if (this.speciesId === Species.ARCEUS) { if (this.speciesId === Species.ARCEUS) {
ret = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`); ret = i18next.t(`pokemonInfo:Type.${formText?.toUpperCase()}`);
} else if ([ SpeciesFormKey.MEGA, SpeciesFormKey.MEGA_X, SpeciesFormKey.MEGA_Y, SpeciesFormKey.PRIMAL, SpeciesFormKey.GIGANTAMAX, SpeciesFormKey.GIGANTAMAX_RAPID, SpeciesFormKey.GIGANTAMAX_SINGLE, SpeciesFormKey.ETERNAMAX ].includes(formKey as SpeciesFormKey)) { } else if ([ SpeciesFormKey.MEGA, SpeciesFormKey.MEGA_X, SpeciesFormKey.MEGA_Y, SpeciesFormKey.PRIMAL, SpeciesFormKey.GIGANTAMAX, SpeciesFormKey.GIGANTAMAX_RAPID, SpeciesFormKey.GIGANTAMAX_SINGLE, SpeciesFormKey.ETERNAMAX ].includes(formKey as SpeciesFormKey)) {
return i18next.t(`battlePokemonForm:${formKey}`, { pokemonName: "" }); return i18next.t(`battlePokemonForm:${formKey}`, { pokemonName: (append ? this.name : "") });
} else if (region === Region.NORMAL || (this.speciesId === Species.GALAR_DARMANITAN && formIndex > 0) || this.speciesId === Species.PALDEA_TAUROS) { } else if (region === Region.NORMAL || (this.speciesId === Species.GALAR_DARMANITAN && formIndex > 0) || this.speciesId === Species.PALDEA_TAUROS) { // More special cases can be added here
const i18key = `pokemonForm:${speciesName}${formText}`; const i18key = `pokemonForm:${speciesName}${formText}`;
if (i18next.exists(i18key)) { if (i18next.exists(i18key)) {
ret = i18next.t(i18key); ret = i18next.t(i18key);
@ -735,15 +728,16 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`; const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`;
ret = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText; ret = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText;
} }
} else if (this.speciesId === Species.ETERNAL_FLOETTE) { } else if (append) { // Everything beyond this has an expanded name
ret = i18next.t("pokemonForm:floetteEternalFlower"); return this.getExpandedSpeciesName();
} else if (this.speciesId === Species.BLOODMOON_URSALUNA) { } else if (this.speciesId === Species.ETERNAL_FLOETTE) { // Not a real form, so the key is made up
ret = i18next.t("pokemonForm:ursalunaBloodmoon"); return i18next.t("pokemonForm:floetteEternalFlower");
} else { } else if (this.speciesId === Species.BLOODMOON_URSALUNA) { // Not a real form, so the key is made up
const regionalName = i18next.t(`pokemonForm:regionalForm${Region[region]}`); return i18next.t("pokemonForm:ursalunaBloodmoon");
ret = regionalName; } else { // Only regional forms should be left at this point
return i18next.t(`pokemonForm:regionalForm.${Region[region]}`);
} }
return ret + (append ? this.name : ""); return append ? i18next.t("pokemonForm:appendForm.GENERIC", { pokemonName: this.name, formName: ret }) : ret;
} }
localize(): void { localize(): void {