From 06496f913514d46f13123f1fd9b51f0d558bc675 Mon Sep 17 00:00:00 2001 From: fabske0 <192151969+fabske0@users.noreply.github.com> Date: Sun, 17 Aug 2025 22:13:09 +0200 Subject: [PATCH] [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 --- public/locales | 2 +- src/data/abilities/ability.ts | 8 +++--- src/data/balance/pokemon-evolutions.ts | 11 ++++---- src/data/battler-tags.ts | 3 ++- src/data/challenge.ts | 2 +- src/data/moves/move.ts | 6 ++--- src/data/nature.ts | 4 +-- .../pokemon-forms/form-change-triggers.ts | 26 +++++++++---------- src/data/pokemon-species.ts | 20 +++++++------- src/enums/stat.ts | 4 +-- src/modifier/modifier-type.ts | 7 ++--- src/phases/tera-phase.ts | 3 ++- src/system/achv.ts | 4 +-- src/ui/base-stats-overlay.ts | 5 +++- src/ui/battle-info/battle-info.ts | 3 ++- src/ui/confirm-ui-handler.ts | 4 +-- src/ui/party-ui-handler.ts | 16 ++++++------ src/ui/run-info-ui-handler.ts | 18 ++++++++----- src/ui/summary-ui-handler.ts | 4 +-- 19 files changed, 83 insertions(+), 67 deletions(-) diff --git a/public/locales b/public/locales index 100e607c03d..38d7c1baa23 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 100e607c03d9c5ea0d405b2b75300cd0e6fa1635 +Subproject commit 38d7c1baa2367582770d62b3f4b0239874c1c7e5 diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 03670835dbd..199e0af3efb 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -1184,7 +1184,7 @@ export class PostDefendTypeChangeAbAttr extends PostDefendAbAttr { return i18next.t("abilityTriggers:postDefendTypeChange", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), 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 { return i18next.t("abilityTriggers:pokemonTypeChange", { 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) { 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 }); } } diff --git a/src/data/balance/pokemon-evolutions.ts b/src/data/balance/pokemon-evolutions.ts index 5d3537f4255..a09c1e38eff 100644 --- a/src/data/balance/pokemon-evolutions.ts +++ b/src/data/balance/pokemon-evolutions.ts @@ -15,6 +15,7 @@ import type { Pokemon } from "#field/pokemon"; import type { SpeciesStatBoosterItem, SpeciesStatBoosterModifierType } from "#modifiers/modifier-type"; import { coerceArray, isNullOrUndefined, randSeedInt } from "#utils/common"; import { getPokemonSpecies } from "#utils/pokemon-utils"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; export enum SpeciesWildEvolutionDelay { @@ -133,11 +134,11 @@ export class SpeciesEvolutionCondition { case EvoCondKey.FRIENDSHIP: return i18next.t("pokemonEvolutions:friendship"); 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: - 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: - 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: return i18next.t("pokemonEvolutions:gender", {gender: getGenderSymbol(cond.gender)}); case EvoCondKey.MOVE: @@ -156,7 +157,7 @@ export class SpeciesEvolutionCondition { case EvoCondKey.SPECIES_CAUGHT: return i18next.t("pokemonEvolutions:caught", {species: getPokemonSpecies(cond.speciesCaught).name}); 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 return this.desc; @@ -245,7 +246,7 @@ export class SpeciesFormEvolution { } if (this.item) { 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})); } if (this.condition) { diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 1199ac581a6..5fcc831f447 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -50,6 +50,7 @@ import type { } from "#types/battler-tags"; import type { Mutable } from "#types/type-helpers"; import { BooleanHolder, coerceArray, getFrameMs, isNullOrUndefined, NumberHolder, toDmgValue } from "#utils/common"; +import { toCamelCase } from "#utils/strings"; /** * @module @@ -2305,7 +2306,7 @@ export class TypeBoostTag extends SerializableBattlerTag { globalScene.phaseManager.queueMessage( i18next.t("abilityTriggers:typeImmunityPowerBoost", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - typeName: i18next.t(`pokemonInfo:Type.${PokemonType[this.boostedType]}`), + typeName: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.boostedType])}`), }), ); } diff --git a/src/data/challenge.ts b/src/data/challenge.ts index 89435149d2f..34fc338b248 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -756,7 +756,7 @@ export class SingleTypeChallenge extends Challenge { } 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 defaultDesc = i18next.t("challenges:singleType.desc_default"); const typeDesc = i18next.t("challenges:singleType.desc", { diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 4b8c4f2129b..ffcd844224c 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -6675,7 +6675,7 @@ export class CopyBiomeTypeAttr extends MoveEffectAttr { user.summonData.types = [ typeChange ]; 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; } @@ -6803,7 +6803,7 @@ export class AddTypeAttr extends MoveEffectAttr { target.summonData.addedType = this.type; 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; } @@ -6825,7 +6825,7 @@ export class FirstMoveTypeAttr extends MoveEffectAttr { const firstMoveType = target.getMoveset()[0].getMove().type; 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; } diff --git a/src/data/nature.ts b/src/data/nature.ts index b085faebb80..65e401cd288 100644 --- a/src/data/nature.ts +++ b/src/data/nature.ts @@ -3,7 +3,7 @@ import { EFFECTIVE_STATS, getShortenedStatKey, Stat } from "#enums/stat"; import { TextStyle } from "#enums/text-style"; import { UiTheme } from "#enums/ui-theme"; import { getBBCodeFrag } from "#ui/text"; -import { toTitleCase } from "#utils/strings"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; export function getNatureName( @@ -13,7 +13,7 @@ export function getNatureName( ignoreBBCode = false, uiTheme: UiTheme = UiTheme.DEFAULT, ): string { - let ret = toTitleCase(Nature[nature]); + let ret = toCamelCase(Nature[nature]); //Translating nature if (i18next.exists(`nature:${ret}`)) { ret = i18next.t(`nature:${ret}` as any); diff --git a/src/data/pokemon-forms/form-change-triggers.ts b/src/data/pokemon-forms/form-change-triggers.ts index c24466eb5ec..7c042b27058 100644 --- a/src/data/pokemon-forms/form-change-triggers.ts +++ b/src/data/pokemon-forms/form-change-triggers.ts @@ -30,7 +30,7 @@ export abstract class SpeciesFormChangeTrigger { export class SpeciesFormChangeManualTrigger 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 { @@ -69,10 +69,10 @@ export class SpeciesFormChangeItemTrigger extends SpeciesFormChangeTrigger { this.item = item; this.active = active; this.description = this.active - ? i18next.t("pokemonEvolutions:Forms.item", { + ? i18next.t("pokemonEvolutions:forms.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]}`), }); } @@ -97,7 +97,7 @@ export class SpeciesFormChangeTimeOfDayTrigger extends SpeciesFormChangeTrigger constructor(...timesOfDay: TimeOfDay[]) { super(); this.timesOfDay = timesOfDay; - this.description = i18next.t("pokemonEvolutions:Forms.timeOfDay"); + this.description = i18next.t("pokemonEvolutions:orms.timeOfDay"); } canChange(_pokemon: Pokemon): boolean { @@ -111,8 +111,8 @@ export class SpeciesFormChangeActiveTrigger extends SpeciesFormChangeTrigger { super(); this.active = active; this.description = this.active - ? i18next.t("pokemonEvolutions:Forms.enter") - : i18next.t("pokemonEvolutions:Forms.leave"); + ? i18next.t("pokemonEvolutions:forms.enter") + : i18next.t("pokemonEvolutions:forms.leave"); } canChange(pokemon: Pokemon): boolean { @@ -128,7 +128,7 @@ export class SpeciesFormChangeStatusEffectTrigger extends SpeciesFormChangeTrigg super(); this.statusEffects = coerceArray(statusEffects); this.invert = invert; - // this.description = i18next.t("pokemonEvolutions:Forms.statusEffect"); + // this.description = i18next.t("pokemonEvolutions:forms.statusEffect"); } canChange(pokemon: Pokemon): boolean { @@ -146,10 +146,10 @@ export class SpeciesFormChangeMoveLearnedTrigger extends SpeciesFormChangeTrigge this.known = known; const moveKey = toCamelCase(MoveId[this.move]); this.description = known - ? i18next.t("pokemonEvolutions:Forms.moveLearned", { + ? i18next.t("pokemonEvolutions:forms.moveLearned", { move: i18next.t(`move:${moveKey}.name`), }) - : i18next.t("pokemonEvolutions:Forms.moveForgotten", { + : i18next.t("pokemonEvolutions:forms.moveForgotten", { move: i18next.t(`move:${moveKey}.name`), }); } @@ -171,7 +171,7 @@ export abstract class SpeciesFormChangeMoveTrigger extends SpeciesFormChangeTrig } export class SpeciesFormChangePreMoveTrigger extends SpeciesFormChangeMoveTrigger { - description = i18next.t("pokemonEvolutions:Forms.preMove"); + description = i18next.t("pokemonEvolutions:forms.preMove"); canChange(pokemon: Pokemon): boolean { const command = globalScene.currentBattle.turnCommands[pokemon.getBattlerIndex()]; return !!command?.move && this.movePredicate(command.move.move) === this.used; @@ -179,7 +179,7 @@ export class SpeciesFormChangePreMoveTrigger extends SpeciesFormChangeMoveTrigge } export class SpeciesFormChangePostMoveTrigger extends SpeciesFormChangeMoveTrigger { - description = i18next.t("pokemonEvolutions:Forms.postMove"); + description = i18next.t("pokemonEvolutions:forms.postMove"); canChange(pokemon: Pokemon): boolean { return ( pokemon.summonData && !!pokemon.getLastXMoves(1).filter(m => this.movePredicate(m.move)).length === this.used @@ -244,7 +244,7 @@ export class SpeciesFormChangeWeatherTrigger extends SpeciesFormChangeTrigger { super(); this.ability = ability; 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(); this.ability = ability; this.weathers = weathers; - this.description = i18next.t("pokemonEvolutions:Forms.weatherRevert"); + this.description = i18next.t("pokemonEvolutions:forms.weatherRevert"); } /** diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 7bfe02d9086..064ad57cfb3 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -778,7 +778,7 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { } if (key) { - return i18next.t(`battlePokemonForm:${key}`, { + return i18next.t(`battlePokemonForm:${toCamelCase(key)}`, { 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 } // 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(); if (this.speciesId === SpeciesId.ARCEUS) { - ret = i18next.t(`pokemonInfo:Type.${formText.toUpperCase()}`); + ret = i18next.t(`pokemonInfo:type.${toCamelCase(formText)}`); } else if ( [ SpeciesFormKey.MEGA, @@ -841,8 +843,8 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { ].includes(formKey as SpeciesFormKey) ) { return append - ? i18next.t(`battlePokemonForm:${formKey}`, { pokemonName: this.name }) - : i18next.t(`pokemonForm:battleForm.${formKey}`); + ? i18next.t(`battlePokemonForm:${toCamelCase(formKey)}`, { pokemonName: this.name }) + : i18next.t(`pokemonForm:battleForm.${toCamelCase(formKey)}`); } else if ( region === Region.NORMAL || (this.speciesId === SpeciesId.GALAR_DARMANITAN && formIndex > 0) || @@ -868,10 +870,10 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { return i18next.t("pokemonForm:ursalunaBloodmoon"); } else { // 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 - ? i18next.t("pokemonForm:appendForm.GENERIC", { + ? i18next.t("pokemonForm:appendForm.generic", { pokemonName: this.name, formName: ret, }) @@ -879,8 +881,8 @@ export class PokemonSpecies extends PokemonSpeciesForm implements Localizable { } localize(): void { - this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`); - this.category = i18next.t(`pokemonCategory:${SpeciesId[this.speciesId].toLowerCase()}_category`); + this.name = i18next.t(`pokemon:${toCamelCase(SpeciesId[this.speciesId])}`); + this.category = i18next.t(`pokemonCategory:${toCamelCase(SpeciesId[this.speciesId])}Category`); } getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId { diff --git a/src/enums/stat.ts b/src/enums/stat.ts index a2b81b7e64b..72ccc065850 100644 --- a/src/enums/stat.ts +++ b/src/enums/stat.ts @@ -64,7 +64,7 @@ export function getStatStageChangeDescriptionKey(stages: number, isIncrease: boo * @returns the translation key corresponding to the given {@linkcode 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} */ export function getShortenedStatKey(stat: PermanentStat) { - return `pokemonInfo:Stat.${Stat[stat]}shortened`; + return `pokemonInfo:stat.${Stat[stat].toLowerCase()}Shortened`; } diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index aca49313ff5..8b77900cb62 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -130,6 +130,7 @@ import { } from "#utils/common"; import { getEnumKeys, getEnumValues } from "#utils/enums"; import { getModifierPoolForType, getModifierType } from "#utils/modifier-utils"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; const outputModifierData = false; @@ -451,13 +452,13 @@ export class TerastallizeModifierType extends PokemonModifierType { get name(): string { 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 { 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 { // TODO: Need getTypeName? return i18next.t("modifierType:ModifierType.AttackTypeBoosterModifierType.description", { - moveType: i18next.t(`pokemonInfo:Type.${PokemonType[this.moveType]}`), + moveType: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.moveType])}`), }); } diff --git a/src/phases/tera-phase.ts b/src/phases/tera-phase.ts index 84b05d88abe..5e42fab82ba 100644 --- a/src/phases/tera-phase.ts +++ b/src/phases/tera-phase.ts @@ -7,6 +7,7 @@ import { PokemonType } from "#enums/pokemon-type"; import type { Pokemon } from "#field/pokemon"; import { BattlePhase } from "#phases/battle-phase"; import { achvs } from "#system/achv"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; export class TeraPhase extends BattlePhase { @@ -25,7 +26,7 @@ export class TeraPhase extends BattlePhase { globalScene.phaseManager.queueMessage( i18next.t("battle:pokemonTerastallized", { 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, () => { diff --git a/src/system/achv.ts b/src/system/achv.ts index 45718a3690f..f51e5ea459c 100644 --- a/src/system/achv.ts +++ b/src/system/achv.ts @@ -15,6 +15,7 @@ import { TurnHeldItemTransferModifier } from "#modifiers/modifier"; import type { ConditionFn } from "#types/common"; import { isNuzlockeChallenge } from "#utils/challenge-utils"; import { NumberHolder } from "#utils/common"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; import type { Modifier } from "typescript"; @@ -436,8 +437,7 @@ export function getAchievementDescription(localizationKey: string): string { case "monoFairy": return i18next.t("achv:monoType.description", { context: genderStr, - // Todo: Remove the `toUpperCase()` again after changing the `pokemonInfo.json` locales - type: i18next.t(`pokemonInfo:Type.${localizationKey.slice(4).toUpperCase()}`), + type: i18next.t(`pokemonInfo:type.${toCamelCase(localizationKey.slice(4))}`), }); case "freshStart": return i18next.t("achv:freshStart.description", { context: genderStr }); diff --git a/src/ui/base-stats-overlay.ts b/src/ui/base-stats-overlay.ts index 3b432e13096..b3cccf34298 100644 --- a/src/ui/base-stats-overlay.ts +++ b/src/ui/base-stats-overlay.ts @@ -4,6 +4,7 @@ import { TextStyle } from "#enums/text-style"; import { addTextObject } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { fixedInt } from "#utils/common"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; 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(values: number[], total: number): boolean { 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. // TODO: change color based on value. this.statsShadows[i].setSize(values[i] / 2, 5); diff --git a/src/ui/battle-info/battle-info.ts b/src/ui/battle-info/battle-info.ts index 0aedfbdf5e7..810d0c7c328 100644 --- a/src/ui/battle-info/battle-info.ts +++ b/src/ui/battle-info/battle-info.ts @@ -9,6 +9,7 @@ import type { Pokemon } from "#field/pokemon"; import { getVariantTint } from "#sprites/variant"; import { addTextObject } from "#ui/text"; import { fixedInt, getLocalizedSpriteKey, getShinyDescriptor } from "#utils/common"; +import { toCamelCase } from "#utils/strings"; import i18next from "i18next"; /** @@ -361,7 +362,7 @@ export abstract class BattleInfo extends Phaser.GameObjects.Container { globalScene.ui.showTooltip( "", i18next.t("fightUiHandler:teraHover", { - type: i18next.t(`pokemonInfo:Type.${PokemonType[this.lastTeraType]}`), + type: i18next.t(`pokemonInfo:type.${toCamelCase(PokemonType[this.lastTeraType])}`), }), ); } diff --git a/src/ui/confirm-ui-handler.ts b/src/ui/confirm-ui-handler.ts index 49e88556f1b..529d1bd8bbb 100644 --- a/src/ui/confirm-ui-handler.ts +++ b/src/ui/confirm-ui-handler.ts @@ -31,14 +31,14 @@ export class ConfirmUiHandler extends AbstractOptionSelectUiHandler { const config: OptionSelectConfig = { options: [ { - label: i18next.t("partyUiHandler:SUMMARY"), + label: i18next.t("partyUiHandler:summary"), handler: () => { args[0](); return true; }, }, { - label: i18next.t("partyUiHandler:POKEDEX"), + label: i18next.t("partyUiHandler:pokedex"), handler: () => { args[1](); return true; diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 3101f46f098..6ca134ebd75 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -27,7 +27,7 @@ import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { addWindow } from "#ui/ui-theme"; import { applyChallenges } from "#utils/challenge-utils"; import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common"; -import { toTitleCase } from "#utils/strings"; +import { toCamelCase, toTitleCase } from "#utils/strings"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; @@ -1573,12 +1573,12 @@ export class PartyUiHandler extends MessageUiHandler { const formChangeItemModifiers = this.getFormChangeItemsModifiers(pokemon); if (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) { - 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 { if (this.localizedOptions.includes(option)) { - optionName = i18next.t(`partyUiHandler:${PartyOption[option]}`); + optionName = i18next.t(`partyUiHandler:${toCamelCase(PartyOption[option])}`); } else { optionName = toTitleCase(PartyOption[option]); } @@ -1595,7 +1595,7 @@ export class PartyUiHandler extends MessageUiHandler { .getLevelMoves() .find(plm => plm[1] === move); } else if (option === PartyOption.ALL) { - optionName = i18next.t("partyUiHandler:ALL"); + optionName = i18next.t("partyUiHandler:all"); } else { const itemModifiers = this.getItemModifiers(pokemon); const itemModifier = itemModifiers[option]; @@ -2190,7 +2190,7 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container { setup(party: PartyUiHandler) { this.transferIcon = globalScene.add.sprite(0, 0, "party_transfer"); 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.add(this.transferIcon); @@ -2238,14 +2238,14 @@ class PartyDiscardModeButton extends Phaser.GameObjects.Container { this.transferIcon.setVisible(true); this.discardIcon.setVisible(false); 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; break; case PartyUiMode.DISCARD: this.transferIcon.setVisible(false); this.discardIcon.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; break; } diff --git a/src/ui/run-info-ui-handler.ts b/src/ui/run-info-ui-handler.ts index db0790275fc..a5e21a3a0a1 100644 --- a/src/ui/run-info-ui-handler.ts +++ b/src/ui/run-info-ui-handler.ts @@ -700,7 +700,11 @@ export class RunInfoUiHandler extends UiHandler { const typeTextColor = `[color=${TypeColor[typeRule]}]`; const typeShadowColor = `[shadow=${TypeShadow[typeRule]}]`; const typeText = - typeTextColor + typeShadowColor + i18next.t(`pokemonInfo:Type.${typeRule}`)! + "[/color]" + "[/shadow]"; + typeTextColor + + typeShadowColor + + i18next.t(`pokemonInfo:type.${toCamelCase(typeRule)}`)! + + "[/color]" + + "[/shadow]"; rules.push(typeText); 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=#f89890]↑[/color]" : pStats[i]; } - const hp = i18next.t("pokemonInfo:Stat.HPshortened") + ": " + pStats[0]; - const atk = i18next.t("pokemonInfo:Stat.ATKshortened") + ": " + pStats[1]; - const def = i18next.t("pokemonInfo:Stat.DEFshortened") + ": " + pStats[2]; - const spatk = i18next.t("pokemonInfo:Stat.SPATKshortened") + ": " + pStats[3]; - const spdef = i18next.t("pokemonInfo:Stat.SPDEFshortened") + ": " + pStats[4]; + const hp = i18next.t("pokemonInfo:stat.hpShortened") + ": " + pStats[0]; + const atk = i18next.t("pokemonInfo:stat.atkShortened") + ": " + pStats[1]; + const def = i18next.t("pokemonInfo:stat.defShortened") + ": " + pStats[2]; + const spatk = i18next.t("pokemonInfo:stat.spatkShortened") + ": " + pStats[3]; + const spdef = i18next.t("pokemonInfo:stat.spdefShortened") + ": " + pStats[4]; const speedLabel = currentLanguage === "es-ES" || currentLanguage === "pt_BR" ? i18next.t("runHistory:SPDshortened") - : i18next.t("pokemonInfo:Stat.SPDshortened"); + : i18next.t("pokemonInfo:stat.spdShortened"); const speed = speedLabel + ": " + pStats[5]; // Column 1: HP Atk Def const pokeStatText1 = addBBCodeTextObject(-5, 0, hp, TextStyle.SUMMARY, { diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index b6ce0a706f8..01d9b981563 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -37,7 +37,7 @@ import { rgbHexToRgba, } from "#utils/common"; import { getEnumValues } from "#utils/enums"; -import { toTitleCase } from "#utils/strings"; +import { toCamelCase, toTitleCase } from "#utils/strings"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; @@ -962,7 +962,7 @@ export class SummaryUiHandler extends UiHandler { this.passiveContainer?.descriptionText?.setVisible(false); 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 memoString = i18next.t("pokemonSummary:memoString", {