From 245138f74d4271b38c788286b608f0ae30556b06 Mon Sep 17 00:00:00 2001 From: Amatsune Date: Mon, 24 Jun 2024 02:27:04 +0800 Subject: [PATCH] attempt 2 (cherry picked from commit 8588ad17b9b2d23e8956f29ba62cc0c4bce64140) --- src/data/pokemon-species.ts | 19 ++++++++----------- src/locales/de/config.ts | 2 ++ src/locales/en/config.ts | 2 ++ src/locales/es/config.ts | 2 ++ src/locales/fr/config.ts | 2 ++ src/locales/it/config.ts | 2 ++ src/locales/ko/config.ts | 2 ++ src/locales/pt_BR/config.ts | 2 ++ src/locales/zh_CN/config.ts | 2 ++ src/locales/zh_TW/config.ts | 2 ++ 10 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index cad5b283cbc..8356ed26a24 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -14,7 +14,7 @@ import { GameMode } from "../game-mode"; import { QuantizerCelebi, argbFromRgba, rgbaFromArgb } from "@material/material-color-utilities"; import { VariantSet } from "./variant"; import i18next from "i18next"; -import { Localizable } from "#app/interfaces/locales"; +import { FusionTranslationEntry, Localizable } from "#app/interfaces/locales"; import { Stat } from "./pokemon-stat"; import { Abilities } from "#enums/abilities"; import { PartyMemberStrength } from "#enums/party-member-strength"; @@ -51,18 +51,15 @@ export function getPokemonSpeciesForm(species: Species, formIndex: integer): Pok } export function getFusedSpeciesName(speciesAName: string, speciesBName: string): string { - // Get the fusion affixes for the species - const speciesAFusionAffixes = fusionAffixes[speciesAName]; - const speciesBFusionAffixes = fusionAffixes[speciesBName]; + const speciesA = i18next.t(`fusionAffixes:${speciesAName}`) as FusionTranslationEntry; + const speciesB = i18next.t(`fusionAffixes:${speciesBName}`) as FusionTranslationEntry; - // Get the fusion prefix and suffix for each species - const speciesAPrefix = speciesAFusionAffixes.fusionPrefix; - const speciesBSuffix = speciesBFusionAffixes.fusionSuffix; + if (!speciesA || !speciesB) { + throw new Error(`One or both species not found: ${speciesAName}, ${speciesBName}`); + } - // Construct the fused species name - const fusedSpeciesName = `${speciesAPrefix}${speciesBSuffix}`; - - return fusedSpeciesName; + // Combine the fusionPrefix of speciesA with the fusionSuffix of speciesB using template literals + return `${speciesA.fusionPrefix}${speciesB.fusionSuffix}`; } export type PokemonSpeciesFilter = (species: PokemonSpecies) => boolean; diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index b01f8343b29..3969af9b36c 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const deConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index ee180163eb1..59ef674eafa 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -40,6 +40,7 @@ import { partyUiHandler } from "./party-ui-handler"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const enConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index ed2477aa14d..9cac0992139 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const esConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 153e9edcf1d..9263f7bb8bc 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const frConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index a6cb95c20eb..e95fd698267 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const itConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/ko/config.ts b/src/locales/ko/config.ts index f3017dd350e..0994079af23 100644 --- a/src/locales/ko/config.ts +++ b/src/locales/ko/config.ts @@ -37,6 +37,7 @@ import { move } from "./move"; import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const koConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/pt_BR/config.ts b/src/locales/pt_BR/config.ts index ce4576646c2..43872f17d28 100644 --- a/src/locales/pt_BR/config.ts +++ b/src/locales/pt_BR/config.ts @@ -40,6 +40,7 @@ import { partyUiHandler } from "./party-ui-handler"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const ptBrConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index 8f00168c58c..0abb97e24cf 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const zhCnConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary, diff --git a/src/locales/zh_TW/config.ts b/src/locales/zh_TW/config.ts index 7a974d58fc3..c15c35607a9 100644 --- a/src/locales/zh_TW/config.ts +++ b/src/locales/zh_TW/config.ts @@ -37,6 +37,7 @@ import { nature } from "./nature"; import { pokeball } from "./pokeball"; import { pokemon } from "./pokemon"; import { pokemonForm } from "./pokemon-form"; +import { fusionAffixes } from "./pokemon-fusion-affixes"; import { pokemonInfo } from "./pokemon-info"; import { pokemonInfoContainer } from "./pokemon-info-container"; import { pokemonSummary } from "./pokemon-summary"; @@ -94,6 +95,7 @@ export const zhTwConfig = { pokeball: pokeball, pokemon: pokemon, pokemonForm: pokemonForm, + fusionAffixes: fusionAffixes, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, pokemonSummary: pokemonSummary,