Support localization of Pokémon abilities (#271)

* Support localization of Pokemon abilities

* Reload ability localization when language is changed

* Add Spanish localization for abilities

* Add missing French abilities localization

* Add missing localize call on abilities

---------

Co-authored-by: Flashfyre <flashfireex@gmail.com>
pull/283/head^2
Pablo González 2024-04-25 03:10:09 +02:00 committed by GitHub
parent ebad76c335
commit 7055ea49c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 4228 additions and 361 deletions

View File

@ -21,6 +21,7 @@ import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesF
import AbilityBar from './ui/ability-bar';
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability';
import { Abilities } from "./data/enums/abilities";
import { allAbilities } from "./data/ability";
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
import { GameMode, GameModes, gameModes } from './game-mode';
import FieldSpritePipeline from './pipelines/field-sprite';
@ -808,6 +809,7 @@ export default class BattleScene extends SceneBase {
const localizable: Localizable[] = [
...allSpecies,
...allMoves,
...allAbilities,
...Utils.getEnumValues(ModifierPoolType).map(mpt => getModifierPoolForType(mpt)).map(mp => Object.values(mp).flat().map(mt => mt.modifierType).filter(mt => 'localize' in mt).map(lpb => lpb as unknown as Localizable)).flat()
];
for (let item of localizable)

File diff suppressed because it is too large Load Diff

1244
src/locales/en/ability.ts Normal file

File diff suppressed because it is too large Load Diff

1244
src/locales/es/ability.ts Normal file

File diff suppressed because it is too large Load Diff

1244
src/locales/fr/ability.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,10 @@ import { move as enMove } from '../locales/en/move';
import { move as esMove } from '../locales/es/move';
import { move as frMove } from '../locales/fr/move';
import { ability as enAbility } from '../locales/en/ability';
import { ability as esAbility } from '../locales/es/ability';
import { ability as frAbility } from '../locales/fr/ability';
import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as esPokeball } from '../locales/es/pokeball';
import { pokeball as frPokeball } from '../locales/fr/pokeball';
@ -39,6 +43,15 @@ export interface MoveTranslationEntries {
[key: string]: MoveTranslationEntry
}
export interface AbilityTranslationEntry {
name: string,
description: string
}
export interface AbilityTranslationEntries {
[key: string]: AbilityTranslationEntry
}
export interface Localizable {
localize(): void;
}
@ -74,6 +87,7 @@ export function initI18n(): void {
en: {
menu: enMenu,
move: enMove,
ability: enAbility,
pokeball: enPokeball,
pokemon: enPokemon,
pokemonStat: enPokemonStat,
@ -82,6 +96,7 @@ export function initI18n(): void {
es: {
menu: esMenu,
move: esMove,
ability: esAbility,
pokeball: esPokeball,
pokemon: esPokemon,
pokemonStat: esPokemonStat,
@ -90,6 +105,7 @@ export function initI18n(): void {
fr: {
menu: frMenu,
move: frMove,
ability: frAbility,
pokeball: frPokeball,
pokemon: frPokemon,
pokemonStat: frPokemonStat,
@ -109,6 +125,7 @@ declare module 'i18next' {
resources: {
menu: typeof enMenu;
move: typeof enMove;
ability: typeof enAbility;
pokeball: typeof enPokeball;
pokemon: typeof enPokemon;
pokemonStat: typeof enPokemonStat;