[i18n] Change i18n keys to be camel case Part 3 (#6266)

* chnage nature locales use

* chnage party ui locales use

* change pokemon category locales use

* chnage pokemon evos locales uses

* change pokemon form battle use

* change pokemon form uses

* Change pokemon info uses

* fix `stat.ts` workflow fail

* Change pokemon summary

* Change pokemon localize

* Temporarily revert changes to `achv.ts`

* Re-add changes to `achv.ts`

* Update locales submodule
This commit is contained in:
fabske0 2025-08-17 22:13:09 +02:00 committed by GitHub
parent 03f54c1d8a
commit 06496f9135
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 83 additions and 67 deletions

@ -1 +1 @@
Subproject commit 100e607c03d9c5ea0d405b2b75300cd0e6fa1635 Subproject commit 38d7c1baa2367582770d62b3f4b0239874c1c7e5

View File

@ -1184,7 +1184,7 @@ export class PostDefendTypeChangeAbAttr extends PostDefendAbAttr {
return i18next.t("abilityTriggers:postDefendTypeChange", { return i18next.t("abilityTriggers:postDefendTypeChange", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
abilityName, abilityName,
typeName: i18next.t(`pokemonInfo:Type.${PokemonType[this.type]}`), typeName: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.type])}`),
}); });
} }
} }
@ -1749,7 +1749,7 @@ export class PokemonTypeChangeAbAttr extends PreAttackAbAttr {
getTriggerMessage({ pokemon }: AugmentMoveInteractionAbAttrParams, _abilityName: string): string { getTriggerMessage({ pokemon }: AugmentMoveInteractionAbAttrParams, _abilityName: string): string {
return i18next.t("abilityTriggers:pokemonTypeChange", { return i18next.t("abilityTriggers:pokemonTypeChange", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
moveType: i18next.t(`pokemonInfo:Type.${PokemonType[this.moveType]}`), moveType: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.moveType])}`),
}); });
} }
} }
@ -6222,7 +6222,9 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
if (currentTerrain === TerrainType.NONE) { if (currentTerrain === TerrainType.NONE) {
return i18next.t("abilityTriggers:pokemonTypeChangeRevert", { pokemonNameWithAffix }); return i18next.t("abilityTriggers:pokemonTypeChangeRevert", { pokemonNameWithAffix });
} }
const moveType = i18next.t(`pokemonInfo:Type.${PokemonType[this.determineTypeChange(pokemon, currentTerrain)[0]]}`); const moveType = i18next.t(
`pokemonInfo:type.${toCamelCase(PokemonType[this.determineTypeChange(pokemon, currentTerrain)[0]])}`,
);
return i18next.t("abilityTriggers:pokemonTypeChange", { pokemonNameWithAffix, moveType }); return i18next.t("abilityTriggers:pokemonTypeChange", { pokemonNameWithAffix, moveType });
} }
} }

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,11 +134,11 @@ 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.${toCamelCase(PokemonType[cond.pkmnType])}`)});
case EvoCondKey.PARTY_TYPE: case EvoCondKey.PARTY_TYPE:
return i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:Type.${PokemonType[cond.pkmnType]}`)}); return i18next.t("pokemonEvolutions:partyType", {type: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[cond.pkmnType])}`)});
case EvoCondKey.GENDER: case EvoCondKey.GENDER:
return i18next.t("pokemonEvolutions:gender", {gender: getGenderSymbol(cond.gender)}); return i18next.t("pokemonEvolutions:gender", {gender: getGenderSymbol(cond.gender)});
case EvoCondKey.MOVE: case EvoCondKey.MOVE:
@ -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

@ -50,6 +50,7 @@ import type {
} from "#types/battler-tags"; } from "#types/battler-tags";
import type { Mutable } from "#types/type-helpers"; import type { Mutable } from "#types/type-helpers";
import { BooleanHolder, coerceArray, getFrameMs, isNullOrUndefined, NumberHolder, toDmgValue } from "#utils/common"; import { BooleanHolder, coerceArray, getFrameMs, isNullOrUndefined, NumberHolder, toDmgValue } from "#utils/common";
import { toCamelCase } from "#utils/strings";
/** /**
* @module * @module
@ -2305,7 +2306,7 @@ export class TypeBoostTag extends SerializableBattlerTag {
globalScene.phaseManager.queueMessage( globalScene.phaseManager.queueMessage(
i18next.t("abilityTriggers:typeImmunityPowerBoost", { i18next.t("abilityTriggers:typeImmunityPowerBoost", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
typeName: i18next.t(`pokemonInfo:Type.${PokemonType[this.boostedType]}`), typeName: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.boostedType])}`),
}), }),
); );
} }

View File

@ -756,7 +756,7 @@ export class SingleTypeChallenge extends Challenge {
} }
getDescription(overrideValue: number = this.value): string { getDescription(overrideValue: number = this.value): string {
const type = i18next.t(`pokemonInfo:Type.${PokemonType[overrideValue - 1]}`); const type = i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[overrideValue - 1])}`);
const typeColor = `[color=${TypeColor[PokemonType[overrideValue - 1]]}][shadow=${TypeShadow[PokemonType[this.value - 1]]}]${type}[/shadow][/color]`; const typeColor = `[color=${TypeColor[PokemonType[overrideValue - 1]]}][shadow=${TypeShadow[PokemonType[this.value - 1]]}]${type}[/shadow][/color]`;
const defaultDesc = i18next.t("challenges:singleType.desc_default"); const defaultDesc = i18next.t("challenges:singleType.desc_default");
const typeDesc = i18next.t("challenges:singleType.desc", { const typeDesc = i18next.t("challenges:singleType.desc", {

View File

@ -6675,7 +6675,7 @@ export class CopyBiomeTypeAttr extends MoveEffectAttr {
user.summonData.types = [ typeChange ]; user.summonData.types = [ typeChange ];
user.updateInfo(); user.updateInfo();
globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), typeName: i18next.t(`pokemonInfo:Type.${PokemonType[typeChange]}`) })); globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), typeName: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[typeChange])}`) }));
return true; return true;
} }
@ -6803,7 +6803,7 @@ export class AddTypeAttr extends MoveEffectAttr {
target.summonData.addedType = this.type; target.summonData.addedType = this.type;
target.updateInfo(); target.updateInfo();
globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:addType", { typeName: i18next.t(`pokemonInfo:Type.${PokemonType[this.type]}`), pokemonName: getPokemonNameWithAffix(target) })); globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:addType", { typeName: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.type])}`), pokemonName: getPokemonNameWithAffix(target) }));
return true; return true;
} }
@ -6825,7 +6825,7 @@ export class FirstMoveTypeAttr extends MoveEffectAttr {
const firstMoveType = target.getMoveset()[0].getMove().type; const firstMoveType = target.getMoveset()[0].getMove().type;
user.summonData.types = [ firstMoveType ]; user.summonData.types = [ firstMoveType ];
globalScene.phaseManager.queueMessage(i18next.t("battle:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), type: i18next.t(`pokemonInfo:Type.${PokemonType[firstMoveType]}`) })); globalScene.phaseManager.queueMessage(i18next.t("battle:transformedIntoType", { pokemonName: getPokemonNameWithAffix(user), type: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[firstMoveType])}`) }));
return true; return true;
} }

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,
}); });
} }
@ -810,7 +810,9 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
return this.name; // Other special cases could be put here too return this.name; // Other special cases could be put here too
} }
// Everything beyond this point essentially follows the pattern of FORMNAME_SPECIES // Everything beyond this point essentially follows the pattern of FORMNAME_SPECIES
return i18next.t(`pokemonForm:appendForm.${SpeciesId[this.speciesId].split("_")[0]}`, { pokemonName: this.name }); return i18next.t(`pokemonForm:appendForm.${toCamelCase(SpeciesId[this.speciesId].split("_")[0])}`, {
pokemonName: this.name,
});
} }
/** /**
@ -827,7 +829,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
const region = this.getRegion(); const region = this.getRegion();
if (this.speciesId === SpeciesId.ARCEUS) { if (this.speciesId === SpeciesId.ARCEUS) {
ret = i18next.t(`pokemonInfo:Type.${formText.toUpperCase()}`); ret = i18next.t(`pokemonInfo:type.${toCamelCase(formText)}`);
} else if ( } else if (
[ [
SpeciesFormKey.MEGA, SpeciesFormKey.MEGA,
@ -841,8 +843,8 @@ 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.${toCamelCase(formKey)}`);
} else if ( } else if (
region === Region.NORMAL || region === Region.NORMAL ||
(this.speciesId === SpeciesId.GALAR_DARMANITAN && formIndex > 0) || (this.speciesId === SpeciesId.GALAR_DARMANITAN && formIndex > 0) ||
@ -868,10 +870,10 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
return i18next.t("pokemonForm:ursalunaBloodmoon"); return i18next.t("pokemonForm:ursalunaBloodmoon");
} else { } else {
// Only regional forms should be left at this point // Only regional forms should be left at this point
return i18next.t(`pokemonForm:regionalForm.${Region[region]}`); return i18next.t(`pokemonForm:regionalForm.${toCamelCase(Region[region])}`);
} }
return append return append
? i18next.t("pokemonForm:appendForm.GENERIC", { ? i18next.t("pokemonForm:appendForm.generic", {
pokemonName: this.name, pokemonName: this.name,
formName: ret, formName: ret,
}) })
@ -879,8 +881,8 @@ 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:${toCamelCase(SpeciesId[this.speciesId])}`);
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

@ -64,7 +64,7 @@ export function getStatStageChangeDescriptionKey(stages: number, isIncrease: boo
* @returns the translation key corresponding to the given {@linkcode Stat} * @returns the translation key corresponding to the given {@linkcode Stat}
*/ */
export function getStatKey(stat: Stat) { export function getStatKey(stat: Stat) {
return `pokemonInfo:Stat.${Stat[stat]}`; return `pokemonInfo:stat.${Stat[stat].toLowerCase()}`;
} }
/** /**
@ -73,5 +73,5 @@ export function getStatKey(stat: Stat) {
* @returns the translation key corresponding to the given {@linkcode Stat} * @returns the translation key corresponding to the given {@linkcode Stat}
*/ */
export function getShortenedStatKey(stat: PermanentStat) { export function getShortenedStatKey(stat: PermanentStat) {
return `pokemonInfo:Stat.${Stat[stat]}shortened`; return `pokemonInfo:stat.${Stat[stat].toLowerCase()}Shortened`;
} }

View File

@ -130,6 +130,7 @@ import {
} from "#utils/common"; } from "#utils/common";
import { getEnumKeys, getEnumValues } from "#utils/enums"; import { getEnumKeys, getEnumValues } from "#utils/enums";
import { getModifierPoolForType, getModifierType } from "#utils/modifier-utils"; import { getModifierPoolForType, getModifierType } from "#utils/modifier-utils";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
const outputModifierData = false; const outputModifierData = false;
@ -451,13 +452,13 @@ export class TerastallizeModifierType extends PokemonModifierType {
get name(): string { get name(): string {
return i18next.t("modifierType:ModifierType.TerastallizeModifierType.name", { return i18next.t("modifierType:ModifierType.TerastallizeModifierType.name", {
teraType: i18next.t(`pokemonInfo:Type.${PokemonType[this.teraType]}`), teraType: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.teraType])}`),
}); });
} }
getDescription(): string { getDescription(): string {
return i18next.t("modifierType:ModifierType.TerastallizeModifierType.description", { return i18next.t("modifierType:ModifierType.TerastallizeModifierType.description", {
teraType: i18next.t(`pokemonInfo:Type.${PokemonType[this.teraType]}`), teraType: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.teraType])}`),
}); });
} }
@ -861,7 +862,7 @@ export class AttackTypeBoosterModifierType
getDescription(): string { getDescription(): string {
// TODO: Need getTypeName? // TODO: Need getTypeName?
return i18next.t("modifierType:ModifierType.AttackTypeBoosterModifierType.description", { return i18next.t("modifierType:ModifierType.AttackTypeBoosterModifierType.description", {
moveType: i18next.t(`pokemonInfo:Type.${PokemonType[this.moveType]}`), moveType: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.moveType])}`),
}); });
} }

View File

@ -7,6 +7,7 @@ import { PokemonType } from "#enums/pokemon-type";
import type { Pokemon } from "#field/pokemon"; import type { Pokemon } from "#field/pokemon";
import { BattlePhase } from "#phases/battle-phase"; import { BattlePhase } from "#phases/battle-phase";
import { achvs } from "#system/achv"; import { achvs } from "#system/achv";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
export class TeraPhase extends BattlePhase { export class TeraPhase extends BattlePhase {
@ -25,7 +26,7 @@ export class TeraPhase extends BattlePhase {
globalScene.phaseManager.queueMessage( globalScene.phaseManager.queueMessage(
i18next.t("battle:pokemonTerastallized", { i18next.t("battle:pokemonTerastallized", {
pokemonNameWithAffix: getPokemonNameWithAffix(this.pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(this.pokemon),
type: i18next.t(`pokemonInfo:Type.${PokemonType[this.pokemon.getTeraType()]}`), type: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.pokemon.getTeraType()])}`),
}), }),
); );
new CommonBattleAnim(CommonAnim.TERASTALLIZE, this.pokemon).play(false, () => { new CommonBattleAnim(CommonAnim.TERASTALLIZE, this.pokemon).play(false, () => {

View File

@ -15,6 +15,7 @@ import { TurnHeldItemTransferModifier } from "#modifiers/modifier";
import type { ConditionFn } from "#types/common"; import type { ConditionFn } from "#types/common";
import { isNuzlockeChallenge } from "#utils/challenge-utils"; import { isNuzlockeChallenge } from "#utils/challenge-utils";
import { NumberHolder } from "#utils/common"; import { NumberHolder } from "#utils/common";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
import type { Modifier } from "typescript"; import type { Modifier } from "typescript";
@ -436,8 +437,7 @@ export function getAchievementDescription(localizationKey: string): string {
case "monoFairy": case "monoFairy":
return i18next.t("achv:monoType.description", { return i18next.t("achv:monoType.description", {
context: genderStr, context: genderStr,
// Todo: Remove the `toUpperCase()` again after changing the `pokemonInfo.json` locales type: i18next.t(`pokemonInfo:type.${toCamelCase(localizationKey.slice(4))}`),
type: i18next.t(`pokemonInfo:Type.${localizationKey.slice(4).toUpperCase()}`),
}); });
case "freshStart": case "freshStart":
return i18next.t("achv:freshStart.description", { context: genderStr }); return i18next.t("achv:freshStart.description", { context: genderStr });

View File

@ -4,6 +4,7 @@ import { TextStyle } from "#enums/text-style";
import { addTextObject } from "#ui/text"; import { addTextObject } from "#ui/text";
import { addWindow } from "#ui/ui-theme"; import { addWindow } from "#ui/ui-theme";
import { fixedInt } from "#utils/common"; import { fixedInt } from "#utils/common";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
interface BaseStatsOverlaySettings { interface BaseStatsOverlaySettings {
@ -68,7 +69,9 @@ export class BaseStatsOverlay extends Phaser.GameObjects.Container implements In
// show this component with infos for the specific move // show this component with infos for the specific move
show(values: number[], total: number): boolean { show(values: number[], total: number): boolean {
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
this.statsLabels[i].setText(i18next.t(`pokemonInfo:Stat.${shortStats[i]}shortened`) + ": " + `${values[i]}`); this.statsLabels[i].setText(
i18next.t(`pokemonInfo:stat.${toCamelCase(shortStats[i])}Shortened`) + ": " + `${values[i]}`,
);
// This accounts for base stats up to 200, might not be enough. // This accounts for base stats up to 200, might not be enough.
// TODO: change color based on value. // TODO: change color based on value.
this.statsShadows[i].setSize(values[i] / 2, 5); this.statsShadows[i].setSize(values[i] / 2, 5);

View File

@ -9,6 +9,7 @@ import type { Pokemon } from "#field/pokemon";
import { getVariantTint } from "#sprites/variant"; import { getVariantTint } from "#sprites/variant";
import { addTextObject } from "#ui/text"; import { addTextObject } from "#ui/text";
import { fixedInt, getLocalizedSpriteKey, getShinyDescriptor } from "#utils/common"; import { fixedInt, getLocalizedSpriteKey, getShinyDescriptor } from "#utils/common";
import { toCamelCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
/** /**
@ -361,7 +362,7 @@ export abstract class BattleInfo extends Phaser.GameObjects.Container {
globalScene.ui.showTooltip( globalScene.ui.showTooltip(
"", "",
i18next.t("fightUiHandler:teraHover", { i18next.t("fightUiHandler:teraHover", {
type: i18next.t(`pokemonInfo:Type.${PokemonType[this.lastTeraType]}`), type: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.lastTeraType])}`),
}), }),
); );
} }

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;
} }

View File

@ -700,7 +700,11 @@ export class RunInfoUiHandler extends UiHandler {
const typeTextColor = `[color=${TypeColor[typeRule]}]`; const typeTextColor = `[color=${TypeColor[typeRule]}]`;
const typeShadowColor = `[shadow=${TypeShadow[typeRule]}]`; const typeShadowColor = `[shadow=${TypeShadow[typeRule]}]`;
const typeText = const typeText =
typeTextColor + typeShadowColor + i18next.t(`pokemonInfo:Type.${typeRule}`)! + "[/color]" + "[/shadow]"; typeTextColor +
typeShadowColor +
i18next.t(`pokemonInfo:type.${toCamelCase(typeRule)}`)! +
"[/color]" +
"[/shadow]";
rules.push(typeText); rules.push(typeText);
break; break;
} }
@ -794,15 +798,15 @@ export class RunInfoUiHandler extends UiHandler {
pStats[i] = isMult < 1 ? pStats[i] + "[color=#40c8f8]↓[/color]" : pStats[i]; pStats[i] = isMult < 1 ? pStats[i] + "[color=#40c8f8]↓[/color]" : pStats[i];
pStats[i] = isMult > 1 ? pStats[i] + "[color=#f89890]↑[/color]" : pStats[i]; pStats[i] = isMult > 1 ? pStats[i] + "[color=#f89890]↑[/color]" : pStats[i];
} }
const hp = i18next.t("pokemonInfo:Stat.HPshortened") + ": " + pStats[0]; const hp = i18next.t("pokemonInfo:stat.hpShortened") + ": " + pStats[0];
const atk = i18next.t("pokemonInfo:Stat.ATKshortened") + ": " + pStats[1]; const atk = i18next.t("pokemonInfo:stat.atkShortened") + ": " + pStats[1];
const def = i18next.t("pokemonInfo:Stat.DEFshortened") + ": " + pStats[2]; const def = i18next.t("pokemonInfo:stat.defShortened") + ": " + pStats[2];
const spatk = i18next.t("pokemonInfo:Stat.SPATKshortened") + ": " + pStats[3]; const spatk = i18next.t("pokemonInfo:stat.spatkShortened") + ": " + pStats[3];
const spdef = i18next.t("pokemonInfo:Stat.SPDEFshortened") + ": " + pStats[4]; const spdef = i18next.t("pokemonInfo:stat.spdefShortened") + ": " + pStats[4];
const speedLabel = const speedLabel =
currentLanguage === "es-ES" || currentLanguage === "pt_BR" currentLanguage === "es-ES" || currentLanguage === "pt_BR"
? i18next.t("runHistory:SPDshortened") ? i18next.t("runHistory:SPDshortened")
: i18next.t("pokemonInfo:Stat.SPDshortened"); : i18next.t("pokemonInfo:stat.spdShortened");
const speed = speedLabel + ": " + pStats[5]; const speed = speedLabel + ": " + pStats[5];
// Column 1: HP Atk Def // Column 1: HP Atk Def
const pokeStatText1 = addBBCodeTextObject(-5, 0, hp, TextStyle.SUMMARY, { const pokeStatText1 = addBBCodeTextObject(-5, 0, hp, TextStyle.SUMMARY, {

View File

@ -37,7 +37,7 @@ import {
rgbHexToRgba, rgbHexToRgba,
} from "#utils/common"; } from "#utils/common";
import { getEnumValues } from "#utils/enums"; import { getEnumValues } from "#utils/enums";
import { toTitleCase } from "#utils/strings"; import { toCamelCase, toTitleCase } from "#utils/strings";
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import i18next from "i18next"; import i18next from "i18next";
@ -962,7 +962,7 @@ export class SummaryUiHandler extends UiHandler {
this.passiveContainer?.descriptionText?.setVisible(false); this.passiveContainer?.descriptionText?.setVisible(false);
const closeFragment = getBBCodeFrag("", TextStyle.WINDOW_ALT); const closeFragment = getBBCodeFrag("", TextStyle.WINDOW_ALT);
const rawNature = toTitleCase(Nature[this.pokemon?.getNature()!]); // TODO: is this bang correct? const rawNature = toCamelCase(Nature[this.pokemon?.getNature()!]); // TODO: is this bang correct?
const nature = `${getBBCodeFrag(toTitleCase(getNatureName(this.pokemon?.getNature()!)), TextStyle.SUMMARY_RED)}${closeFragment}`; // TODO: is this bang correct? const nature = `${getBBCodeFrag(toTitleCase(getNatureName(this.pokemon?.getNature()!)), TextStyle.SUMMARY_RED)}${closeFragment}`; // TODO: is this bang correct?
const memoString = i18next.t("pokemonSummary:memoString", { const memoString = i18next.t("pokemonSummary:memoString", {