Added Ability Triggers Localization (#811)

Adds the base files needed to start translating Ability trigger messages. Provides one as an example.
This commit is contained in:
Benjamin Odom 2024-05-13 18:12:28 -05:00 committed by GitHub
parent 74ee3329f8
commit 1c56efc860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 47 additions and 4 deletions

View File

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

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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 enConfig = {
ability: ability,
abilityTriggers: abilityTriggers,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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,

View File

@ -0,0 +1,5 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const abilityTriggers: SimpleTranslationEntries = {
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
} as const;

View File

@ -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,

View File

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