This commit is contained in:
fabske0 2025-08-16 18:24:43 +02:00 committed by GitHub
commit fc513d3895
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 32 additions and 31 deletions

View File

@ -15,6 +15,7 @@ import type { Pokemon } from "#field/pokemon";
import type { SpeciesStatBoosterItem, SpeciesStatBoosterModifierType } from "#modifiers/modifier-type"; import type { SpeciesStatBoosterItem, SpeciesStatBoosterModifierType } from "#modifiers/modifier-type";
import { coerceArray, isNullOrUndefined, randSeedInt } from "#utils/common"; import { coerceArray, isNullOrUndefined, randSeedInt } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
export enum SpeciesWildEvolutionDelay { export enum SpeciesWildEvolutionDelay {
@ -133,7 +134,7 @@ export class SpeciesEvolutionCondition {
case EvoCondKey.FRIENDSHIP: case EvoCondKey.FRIENDSHIP:
return i18next.t("pokemonEvolutions:friendship"); return i18next.t("pokemonEvolutions:friendship");
case EvoCondKey.TIME: case EvoCondKey.TIME:
return i18next.t(`pokemonEvolutions:timeOfDay.${TimeOfDay[cond.time[cond.time.length - 1]]}`); // For Day and Night evos, the key we want goes last return i18next.t(`pokemonEvolutions:timeOfDay.${toCamelCase(TimeOfDay[cond.time[cond.time.length - 1]])}`); // For Day and Night evos, the key we want goes last
case EvoCondKey.MOVE_TYPE: case EvoCondKey.MOVE_TYPE:
return i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${PokemonType[cond.pkmnType]}`)}); return i18next.t("pokemonEvolutions:moveType", {type: i18next.t(`pokemonInfo:Type.${PokemonType[cond.pkmnType]}`)});
case EvoCondKey.PARTY_TYPE: case EvoCondKey.PARTY_TYPE:
@ -156,7 +157,7 @@ export class SpeciesEvolutionCondition {
case EvoCondKey.SPECIES_CAUGHT: case EvoCondKey.SPECIES_CAUGHT:
return i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(cond.speciesCaught).name}); return i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(cond.speciesCaught).name});
case EvoCondKey.HELD_ITEM: case EvoCondKey.HELD_ITEM:
return i18next.t(`pokemonEvolutions:heldItem.${cond.itemKey}`); return i18next.t(`pokemonEvolutions:heldItem.${toCamelCase(cond.itemKey)}`);
} }
}).filter(s => !isNullOrUndefined(s)); // Filter out stringless conditions }).filter(s => !isNullOrUndefined(s)); // Filter out stringless conditions
return this.desc; return this.desc;
@ -245,7 +246,7 @@ export class SpeciesFormEvolution {
} }
if (this.item) { if (this.item) {
const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[this.item].toUpperCase()}`); const itemDescription = i18next.t(`modifierType:EvolutionItem.${EvolutionItem[this.item].toUpperCase()}`);
const rarity = this.item > 50 ? i18next.t("pokemonEvolutions:ULTRA") : i18next.t("pokemonEvolutions:GREAT"); const rarity = this.item > 50 ? i18next.t("pokemonEvolutions:ultra") : i18next.t("pokemonEvolutions:great");
strings.push(i18next.t("pokemonEvolutions:using", {item: itemDescription, tier: rarity})); strings.push(i18next.t("pokemonEvolutions:using", {item: itemDescription, tier: rarity}));
} }
if (this.condition) { if (this.condition) {

View File

@ -3,7 +3,7 @@ import { EFFECTIVE_STATS, getShortenedStatKey, Stat } from "#enums/stat";
import { TextStyle } from "#enums/text-style"; import { TextStyle } from "#enums/text-style";
import { UiTheme } from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
import { getBBCodeFrag } from "#ui/text"; import { getBBCodeFrag } from "#ui/text";
import { toTitleCase } from "#utils/strings"; import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
export function getNatureName( export function getNatureName(
@ -13,7 +13,7 @@ export function getNatureName(
ignoreBBCode = false, ignoreBBCode = false,
uiTheme: UiTheme = UiTheme.DEFAULT, uiTheme: UiTheme = UiTheme.DEFAULT,
): string { ): string {
let ret = toTitleCase(Nature[nature]); let ret = toCamelCase(Nature[nature]);
//Translating nature //Translating nature
if (i18next.exists(`nature:${ret}`)) { if (i18next.exists(`nature:${ret}`)) {
ret = i18next.t(`nature:${ret}` as any); ret = i18next.t(`nature:${ret}` as any);

View File

@ -30,7 +30,7 @@ export abstract class SpeciesFormChangeTrigger {
export class SpeciesFormChangeManualTrigger extends SpeciesFormChangeTrigger {} export class SpeciesFormChangeManualTrigger extends SpeciesFormChangeTrigger {}
export class SpeciesFormChangeAbilityTrigger extends SpeciesFormChangeTrigger { export class SpeciesFormChangeAbilityTrigger extends SpeciesFormChangeTrigger {
public description: string = i18next.t("pokemonEvolutions:Forms.ability"); public description: string = i18next.t("pokemonEvolutions:forms.ability");
} }
export class SpeciesFormChangeCompoundTrigger { export class SpeciesFormChangeCompoundTrigger {
@ -69,10 +69,10 @@ export class SpeciesFormChangeItemTrigger extends SpeciesFormChangeTrigger {
this.item = item; this.item = item;
this.active = active; this.active = active;
this.description = this.active this.description = this.active
? i18next.t("pokemonEvolutions:Forms.item", { ? i18next.t("pokemonEvolutions:forms.item", {
item: i18next.t(`modifierType:FormChangeItem.${FormChangeItem[this.item]}`), item: i18next.t(`modifierType:FormChangeItem.${FormChangeItem[this.item]}`),
}) })
: i18next.t("pokemonEvolutions:Forms.deactivateItem", { : i18next.t("pokemonEvolutions:forms.deactivateItem", {
item: i18next.t(`modifierType:FormChangeItem.${FormChangeItem[this.item]}`), item: i18next.t(`modifierType:FormChangeItem.${FormChangeItem[this.item]}`),
}); });
} }
@ -97,7 +97,7 @@ export class SpeciesFormChangeTimeOfDayTrigger extends SpeciesFormChangeTrigger
constructor(...timesOfDay: TimeOfDay[]) { constructor(...timesOfDay: TimeOfDay[]) {
super(); super();
this.timesOfDay = timesOfDay; this.timesOfDay = timesOfDay;
this.description = i18next.t("pokemonEvolutions:Forms.timeOfDay"); this.description = i18next.t("pokemonEvolutions:orms.timeOfDay");
} }
canChange(_pokemon: Pokemon): boolean { canChange(_pokemon: Pokemon): boolean {
@ -111,8 +111,8 @@ export class SpeciesFormChangeActiveTrigger extends SpeciesFormChangeTrigger {
super(); super();
this.active = active; this.active = active;
this.description = this.active this.description = this.active
? i18next.t("pokemonEvolutions:Forms.enter") ? i18next.t("pokemonEvolutions:forms.enter")
: i18next.t("pokemonEvolutions:Forms.leave"); : i18next.t("pokemonEvolutions:forms.leave");
} }
canChange(pokemon: Pokemon): boolean { canChange(pokemon: Pokemon): boolean {
@ -128,7 +128,7 @@ export class SpeciesFormChangeStatusEffectTrigger extends SpeciesFormChangeTrigg
super(); super();
this.statusEffects = coerceArray(statusEffects); this.statusEffects = coerceArray(statusEffects);
this.invert = invert; this.invert = invert;
// this.description = i18next.t("pokemonEvolutions:Forms.statusEffect"); // this.description = i18next.t("pokemonEvolutions:forms.statusEffect");
} }
canChange(pokemon: Pokemon): boolean { canChange(pokemon: Pokemon): boolean {
@ -146,10 +146,10 @@ export class SpeciesFormChangeMoveLearnedTrigger extends SpeciesFormChangeTrigge
this.known = known; this.known = known;
const moveKey = toCamelCase(MoveId[this.move]); const moveKey = toCamelCase(MoveId[this.move]);
this.description = known this.description = known
? i18next.t("pokemonEvolutions:Forms.moveLearned", { ? i18next.t("pokemonEvolutions:forms.moveLearned", {
move: i18next.t(`move:${moveKey}.name`), move: i18next.t(`move:${moveKey}.name`),
}) })
: i18next.t("pokemonEvolutions:Forms.moveForgotten", { : i18next.t("pokemonEvolutions:forms.moveForgotten", {
move: i18next.t(`move:${moveKey}.name`), move: i18next.t(`move:${moveKey}.name`),
}); });
} }
@ -171,7 +171,7 @@ export abstract class SpeciesFormChangeMoveTrigger extends SpeciesFormChangeTrig
} }
export class SpeciesFormChangePreMoveTrigger extends SpeciesFormChangeMoveTrigger { export class SpeciesFormChangePreMoveTrigger extends SpeciesFormChangeMoveTrigger {
description = i18next.t("pokemonEvolutions:Forms.preMove"); description = i18next.t("pokemonEvolutions:forms.preMove");
canChange(pokemon: Pokemon): boolean { canChange(pokemon: Pokemon): boolean {
const command = globalScene.currentBattle.turnCommands[pokemon.getBattlerIndex()]; const command = globalScene.currentBattle.turnCommands[pokemon.getBattlerIndex()];
return !!command?.move && this.movePredicate(command.move.move) === this.used; return !!command?.move && this.movePredicate(command.move.move) === this.used;
@ -179,7 +179,7 @@ export class SpeciesFormChangePreMoveTrigger extends SpeciesFormChangeMoveTrigge
} }
export class SpeciesFormChangePostMoveTrigger extends SpeciesFormChangeMoveTrigger { export class SpeciesFormChangePostMoveTrigger extends SpeciesFormChangeMoveTrigger {
description = i18next.t("pokemonEvolutions:Forms.postMove"); description = i18next.t("pokemonEvolutions:forms.postMove");
canChange(pokemon: Pokemon): boolean { canChange(pokemon: Pokemon): boolean {
return ( return (
pokemon.summonData && !!pokemon.getLastXMoves(1).filter(m => this.movePredicate(m.move)).length === this.used pokemon.summonData && !!pokemon.getLastXMoves(1).filter(m => this.movePredicate(m.move)).length === this.used
@ -244,7 +244,7 @@ export class SpeciesFormChangeWeatherTrigger extends SpeciesFormChangeTrigger {
super(); super();
this.ability = ability; this.ability = ability;
this.weathers = weathers; this.weathers = weathers;
this.description = i18next.t("pokemonEvolutions:Forms.weather"); this.description = i18next.t("pokemonEvolutions:forms.weather");
} }
/** /**
@ -282,7 +282,7 @@ export class SpeciesFormChangeRevertWeatherFormTrigger extends SpeciesFormChange
super(); super();
this.ability = ability; this.ability = ability;
this.weathers = weathers; this.weathers = weathers;
this.description = i18next.t("pokemonEvolutions:Forms.weatherRevert"); this.description = i18next.t("pokemonEvolutions:forms.weatherRevert");
} }
/** /**

View File

@ -778,7 +778,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
} }
if (key) { if (key) {
return i18next.t(`battlePokemonForm:${key}`, { return i18next.t(`battlePokemonForm:${toCamelCase(key)}`, {
pokemonName: this.name, pokemonName: this.name,
}); });
} }
@ -841,7 +841,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
].includes(formKey as SpeciesFormKey) ].includes(formKey as SpeciesFormKey)
) { ) {
return append return append
? i18next.t(`battlePokemonForm:${formKey}`, { pokemonName: this.name }) ? i18next.t(`battlePokemonForm:${toCamelCase(formKey)}`, { pokemonName: this.name })
: i18next.t(`pokemonForm:battleForm.${formKey}`); : i18next.t(`pokemonForm:battleForm.${formKey}`);
} else if ( } else if (
region === Region.NORMAL || region === Region.NORMAL ||
@ -880,7 +880,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
localize(): void { localize(): void {
this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`); this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`);
this.category = i18next.t(`pokemonCategory:${SpeciesId[this.speciesId].toLowerCase()}_category`); this.category = i18next.t(`pokemonCategory:${toCamelCase(SpeciesId[this.speciesId])}Category`);
} }
getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId { getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId {

View File

@ -31,14 +31,14 @@ export class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
const config: OptionSelectConfig = { const config: OptionSelectConfig = {
options: [ options: [
{ {
label: i18next.t("partyUiHandler:SUMMARY"), label: i18next.t("partyUiHandler:summary"),
handler: () => { handler: () => {
args[0](); args[0]();
return true; return true;
}, },
}, },
{ {
label: i18next.t("partyUiHandler:POKEDEX"), label: i18next.t("partyUiHandler:pokedex"),
handler: () => { handler: () => {
args[1](); args[1]();
return true; return true;

View File

@ -27,7 +27,7 @@ import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text";
import { addWindow } from "#ui/ui-theme"; import { addWindow } from "#ui/ui-theme";
import { applyChallenges } from "#utils/challenge-utils"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common"; import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common";
import { toTitleCase } from "#utils/strings"; import { toCamelCase, toTitleCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
@ -1573,12 +1573,12 @@ export class PartyUiHandler extends MessageUiHandler {
const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon); const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon);
if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) { if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) {
const modifier = formChangeItemModifiers[option - PartyOption.FORM_CHANGE_ITEM]; const modifier = formChangeItemModifiers[option - PartyOption.FORM_CHANGE_ITEM];
optionName = `${modifier.active ? i18next.t("partyUiHandler:DEACTIVATE") : i18next.t("partyUiHandler:ACTIVATE")} ${modifier.type.name}`; optionName = `${modifier.active ? i18next.t("partyUiHandler:deactivate") : i18next.t("partyUiHandler:activate")} ${modifier.type.name}`;
} else if (option === PartyOption.UNPAUSE_EVOLUTION) { } else if (option === PartyOption.UNPAUSE_EVOLUTION) {
optionName = `${pokemon.pauseEvolutions ? i18next.t("partyUiHandler:UNPAUSE_EVOLUTION") : i18next.t("partyUiHandler:PAUSE_EVOLUTION")}`; optionName = `${pokemon.pauseEvolutions ? i18next.t("partyUiHandler:unpausedEvolution") : i18next.t("partyUiHandler:pauseEvolution")}`;
} else { } else {
if (this.localizedOptions.includes(option)) { if (this.localizedOptions.includes(option)) {
optionName = i18next.t(`partyUiHandler:${PartyOption[option]}`); optionName = i18next.t(`partyUiHandler:${toCamelCase(PartyOption[option])}`);
} else { } else {
optionName = toTitleCase(PartyOption[option]); optionName = toTitleCase(PartyOption[option]);
} }
@ -1595,7 +1595,7 @@ export class PartyUiHandler extends MessageUiHandler {
.getLevelMoves() .getLevelMoves()
.find(plm => plm[1] === move); .find(plm => plm[1] === move);
} else if (option === PartyOption.ALL) { } else if (option === PartyOption.ALL) {
optionName = i18next.t("partyUiHandler:ALL"); optionName = i18next.t("partyUiHandler:all");
} else { } else {
const itemModifiers = this.getItemModifiers(pokemon); const itemModifiers = this.getItemModifiers(pokemon);
const itemModifier = itemModifiers[option]; const itemModifier = itemModifiers[option];
@ -2190,7 +2190,7 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
setup(party: PartyUiHandler) { setup(party: PartyUiHandler) {
this.transferIcon = globalScene.add.sprite(0, 0, "party_transfer"); this.transferIcon = globalScene.add.sprite(0, 0, "party_transfer");
this.discardIcon = globalScene.add.sprite(0, 0, "party_discard"); this.discardIcon = globalScene.add.sprite(0, 0, "party_discard");
this.textBox = addTextObject(-8, -7, i18next.t("partyUiHandler:TRANSFER"), TextStyle.PARTY); this.textBox = addTextObject(-8, -7, i18next.t("partyUiHandler:transfer"), TextStyle.PARTY);
this.party = party; this.party = party;
this.add(this.transferIcon); this.add(this.transferIcon);
@ -2238,14 +2238,14 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container {
this.transferIcon.setVisible(true); this.transferIcon.setVisible(true);
this.discardIcon.setVisible(false); this.discardIcon.setVisible(false);
this.textBox.setVisible(true); this.textBox.setVisible(true);
this.textBox.setText(i18next.t("partyUiHandler:TRANSFER")); this.textBox.setText(i18next.t("partyUiHandler:transfer"));
this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3; this.transferIcon.displayWidth = this.textBox.text.length * 9 + 3;
break; break;
case PartyUiMode.DISCARD: case PartyUiMode.DISCARD:
this.transferIcon.setVisible(false); this.transferIcon.setVisible(false);
this.discardIcon.setVisible(true); this.discardIcon.setVisible(true);
this.textBox.setVisible(true); this.textBox.setVisible(true);
this.textBox.setText(i18next.t("partyUiHandler:DISCARD")); this.textBox.setText(i18next.t("partyUiHandler:discard"));
this.discardIcon.displayWidth = this.textBox.text.length * 9 + 3; this.discardIcon.displayWidth = this.textBox.text.length * 9 + 3;
break; break;
} }