From 1c56efc860d5531d754c07f8785aa9cf8d0603af Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Mon, 13 May 2024 18:12:28 -0500 Subject: [PATCH] Added Ability Triggers Localization (#811) Adds the base files needed to start translating Ability trigger messages. Provides one as an example. --- src/data/ability.ts | 4 ++-- src/locales/de/ability-trigger.ts | 5 +++++ src/locales/de/config.ts | 2 ++ src/locales/en/ability-trigger.ts | 5 +++++ src/locales/en/config.ts | 4 +++- src/locales/es/ability-trigger.ts | 5 +++++ src/locales/es/config.ts | 2 ++ src/locales/fr/ability-trigger.ts | 5 +++++ src/locales/fr/config.ts | 2 ++ src/locales/it/ability-trigger.ts | 5 +++++ src/locales/it/config.ts | 2 ++ src/locales/zh_CN/ability-trigger.ts | 5 +++++ src/locales/zh_CN/config.ts | 2 ++ src/plugins/i18n.ts | 3 ++- 14 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 src/locales/de/ability-trigger.ts create mode 100644 src/locales/en/ability-trigger.ts create mode 100644 src/locales/es/ability-trigger.ts create mode 100644 src/locales/fr/ability-trigger.ts create mode 100644 src/locales/it/ability-trigger.ts create mode 100644 src/locales/zh_CN/ability-trigger.ts diff --git a/src/data/ability.ts b/src/data/ability.ts index b2899a33f..5ef07c39f 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3,7 +3,7 @@ import { Type } from "./type"; import * as Utils from "../utils"; import { BattleStat, getBattleStatName } from "./battle-stat"; import { PokemonHealPhase, ShowAbilityPhase, StatChangePhase } from "../phases"; -import { getPokemonMessage } from "../messages"; +import { getPokemonMessage, getPokemonPrefix } from "../messages"; import { Weather, WeatherType } from "./weather"; import { BattlerTag } from "./battler-tags"; import { BattlerTagType } from "./enums/battler-tag-type"; @@ -144,7 +144,7 @@ export class BlockRecoilDamageAttr extends AbAttr { } getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) { - return getPokemonMessage(pokemon, `'s ${abilityName}\nprotected it from recoil!`); + return i18next.t('abilityTriggers:blockRecoilDamage', {pokemonName: `${getPokemonPrefix(pokemon)}${pokemon.name}`, abilityName: abilityName}); } } diff --git a/src/locales/de/ability-trigger.ts b/src/locales/de/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/de/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 2cc7a52c8..a9f4cd682 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const deConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/en/ability-trigger.ts b/src/locales/en/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/en/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 029791a70..f5e8a68b0 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -14,8 +15,9 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { tutorial } from "./tutorial"; -export const enConfig = { +export const enConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/es/ability-trigger.ts b/src/locales/es/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/es/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index 564b8dd32..c56a8d384 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const esConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/fr/ability-trigger.ts b/src/locales/fr/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/fr/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 90f9fb83c..89669aceb 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const frConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/it/ability-trigger.ts b/src/locales/it/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/it/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index bbfd452dc..6ba9aa3af 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -16,6 +17,7 @@ import { tutorial } from "./tutorial"; export const itConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/locales/zh_CN/ability-trigger.ts b/src/locales/zh_CN/ability-trigger.ts new file mode 100644 index 000000000..889007412 --- /dev/null +++ b/src/locales/zh_CN/ability-trigger.ts @@ -0,0 +1,5 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const abilityTriggers: SimpleTranslationEntries = { + 'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`, +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index a8f5f878b..496fd983c 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -1,4 +1,5 @@ import { ability } from "./ability"; +import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; import { fightUiHandler } from "./fight-ui-handler"; @@ -15,6 +16,7 @@ import { nature } from "./nature"; export const zhCnConfig = { ability: ability, + abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, fightUiHandler: fightUiHandler, diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 676e691ee..82a5a51ba 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -98,7 +98,8 @@ declare module 'i18next' { menu: SimpleTranslationEntries; menuUiHandler: SimpleTranslationEntries; move: MoveTranslationEntries; - battle: SimpleTranslationEntries, + battle: SimpleTranslationEntries; + abilityTriggers: SimpleTranslationEntries; ability: AbilityTranslationEntries; pokeball: SimpleTranslationEntries; pokemon: SimpleTranslationEntries;