Allowing pokemon name translation (#228)
* Allow pokemon name translation * Improve Pokemon localization --------- Co-authored-by: Flashfyre <flashfireex@gmail.com>
This commit is contained in:
parent
1a53c19e3b
commit
8d7f1ae554
|
@ -796,6 +796,7 @@ export default class BattleScene extends SceneBase {
|
||||||
|
|
||||||
if (reloadI18n) {
|
if (reloadI18n) {
|
||||||
const localizable: Localizable[] = [
|
const localizable: Localizable[] = [
|
||||||
|
...allSpecies,
|
||||||
...allMoves,
|
...allMoves,
|
||||||
...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()
|
...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()
|
||||||
];
|
];
|
||||||
|
|
|
@ -249,7 +249,7 @@ export async function printPokemon() {
|
||||||
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 3)?.ability.name), 0)
|
Math.max(abilities.indexOf(pokemon.abilities.find(a => a.slot === 3)?.ability.name), 0)
|
||||||
];
|
];
|
||||||
|
|
||||||
const pokemonSpecies = new PokemonSpecies(dexId, species.names.find(n => n.language.name === 'en').name, generationIndex, species.is_legendary && baseTotal < 660, species.is_legendary && baseTotal >= 660, species.is_mythical,
|
const pokemonSpecies = new PokemonSpecies(dexId, generationIndex, species.is_legendary && baseTotal < 660, species.is_legendary && baseTotal >= 660, species.is_mythical,
|
||||||
species.genera.find(g => g.language.name === 'en')?.genus, type1 as Type, type2 > -1 ? type2 as Type : null, pokemon.height / 10, pokemon.weight / 10, ability1 as Abilities, ability2 as Abilities, abilityHidden as Abilities,
|
species.genera.find(g => g.language.name === 'en')?.genus, type1 as Type, type2 > -1 ? type2 as Type : null, pokemon.height / 10, pokemon.weight / 10, ability1 as Abilities, ability2 as Abilities, abilityHidden as Abilities,
|
||||||
baseTotal, baseStats[0], baseStats[1], baseStats[2], baseStats[3], baseStats[4], baseStats[5], species.capture_rate, species.base_happiness, pokemon.base_experience, growthRateMap[species.growth_rate.name],
|
baseTotal, baseStats[0], baseStats[1], baseStats[2], baseStats[3], baseStats[4], baseStats[5], species.capture_rate, species.base_happiness, pokemon.base_experience, growthRateMap[species.growth_rate.name],
|
||||||
species.gender_rate < 9 ? 100 - (species.gender_rate * 12.5) : null, species.has_gender_differences, species.forms_switchable);
|
species.gender_rate < 9 ? 100 - (species.gender_rate * 12.5) : null, species.has_gender_differences, species.forms_switchable);
|
||||||
|
|
|
@ -96,9 +96,6 @@ export default class Move implements Localizable {
|
||||||
constructor(id: Moves, type: Type, category: MoveCategory, defaultMoveTarget: MoveTarget, power: integer, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
|
constructor(id: Moves, type: Type, category: MoveCategory, defaultMoveTarget: MoveTarget, power: integer, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
const i18nKey = Moves[id].split('_').filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join('') as unknown as string;
|
|
||||||
|
|
||||||
this.name = id ? i18next.t(`move:${i18nKey}.name`).toString() : '';
|
|
||||||
this.nameAppend = '';
|
this.nameAppend = '';
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
@ -106,7 +103,6 @@ export default class Move implements Localizable {
|
||||||
this.power = power;
|
this.power = power;
|
||||||
this.accuracy = accuracy;
|
this.accuracy = accuracy;
|
||||||
this.pp = pp;
|
this.pp = pp;
|
||||||
this.effect = id ? i18next.t(`move:${i18nKey}.effect`).toString() : '';
|
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.generation = generation;
|
this.generation = generation;
|
||||||
|
@ -119,9 +115,11 @@ export default class Move implements Localizable {
|
||||||
this.setFlag(MoveFlags.IGNORE_PROTECT, true);
|
this.setFlag(MoveFlags.IGNORE_PROTECT, true);
|
||||||
if (category === MoveCategory.PHYSICAL)
|
if (category === MoveCategory.PHYSICAL)
|
||||||
this.setFlag(MoveFlags.MAKES_CONTACT, true);
|
this.setFlag(MoveFlags.MAKES_CONTACT, true);
|
||||||
|
|
||||||
|
this.localize();
|
||||||
}
|
}
|
||||||
|
|
||||||
localize() {
|
localize(): void {
|
||||||
const i18nKey = Moves[this.id].split('_').filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join('') as unknown as string;
|
const i18nKey = Moves[this.id].split('_').filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join('') as unknown as string;
|
||||||
|
|
||||||
this.name = this.id ? `${i18next.t(`move:${i18nKey}.name`).toString()}${this.nameAppend}` : '';
|
this.name = this.id ? `${i18next.t(`move:${i18nKey}.name`).toString()}${this.nameAppend}` : '';
|
||||||
|
@ -6162,7 +6160,7 @@ export function initMoves() {
|
||||||
.slicingMove(),
|
.slicingMove(),
|
||||||
new AttackMove(Moves.HYDRO_STEAM, Type.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, 0, 9)
|
new AttackMove(Moves.HYDRO_STEAM, Type.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, 0, 9)
|
||||||
.partial(),
|
.partial(),
|
||||||
new AttackMove(Moves.RUINATION, Type.DARK, MoveCategory.SPECIAL, 1, 90, 10, -1, 0, 9)
|
new AttackMove(Moves.RUINATION, Type.DARK, MoveCategory.SPECIAL, -1, 90, 10, -1, 0, 9)
|
||||||
.attr(TargetHalfHpDamageAttr),
|
.attr(TargetHalfHpDamageAttr),
|
||||||
new AttackMove(Moves.COLLISION_COURSE, Type.FIGHTING, MoveCategory.PHYSICAL, 100, 100, 5, -1, 0, 9)
|
new AttackMove(Moves.COLLISION_COURSE, Type.FIGHTING, MoveCategory.PHYSICAL, 100, 100, 5, -1, 0, 9)
|
||||||
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getAttackTypeEffectiveness(move.type) >= 2 ? 5461/4096 : 1),
|
.attr(MovePowerMultiplierAttr, (user, target, move) => target.getAttackTypeEffectiveness(move.type) >= 2 ? 5461/4096 : 1),
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,11 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The menu namespace holds most miscellaneous text that isn't directly part of the game's
|
* The menu namespace holds most miscellaneous text that isn't directly part of the game's
|
||||||
* contents or directly related to Pokemon data. This includes menu navigation, settings,
|
* contents or directly related to Pokemon data. This includes menu navigation, settings,
|
||||||
* account interactions, descriptive text, etc.
|
* account interactions, descriptive text, etc.
|
||||||
*/
|
*/
|
||||||
export const menu = {
|
export const menu: SimpleTranslationEntries = {
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"continue": "Continue",
|
"continue": "Continue",
|
||||||
"dailyRun": "Daily Run (Beta)",
|
"dailyRun": "Daily Run (Beta)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { MoveTranslations } from "#app/plugins/i18n";
|
import { MoveTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const move: MoveTranslations = {
|
export const move: MoveTranslationEntries = {
|
||||||
"pound": {
|
"pound": {
|
||||||
name: "Pound",
|
name: "Pound",
|
||||||
effect: "The target is physically pounded with a long tail, a foreleg, or the like."
|
effect: "The target is physically pounded with a long tail, a foreleg, or the like."
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export const pokeball = {
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const pokeball: SimpleTranslationEntries = {
|
||||||
"pokeBall": "Poké Ball",
|
"pokeBall": "Poké Ball",
|
||||||
"greatBall": "Great Ball",
|
"greatBall": "Great Ball",
|
||||||
"ultraBall": "Ultra Ball",
|
"ultraBall": "Ultra Ball",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,6 @@
|
||||||
export const menu = {
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const menu: SimpleTranslationEntries = {
|
||||||
"cancel": "Annuler",
|
"cancel": "Annuler",
|
||||||
"continue": "Continuer",
|
"continue": "Continuer",
|
||||||
"dailyRun": "Défi du jour (Bêta)",
|
"dailyRun": "Défi du jour (Bêta)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { MoveTranslations } from "#app/plugins/i18n";
|
import { MoveTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const move: MoveTranslations = {
|
export const move: MoveTranslationEntries = {
|
||||||
"pound": {
|
"pound": {
|
||||||
name: "Écras'Face",
|
name: "Écras'Face",
|
||||||
effect: "Le lanceur écrase la cible avec l’un de ses membres, tels qu’une de ses pattes avant ou sa longue queue."
|
effect: "Le lanceur écrase la cible avec l’un de ses membres, tels qu’une de ses pattes avant ou sa longue queue."
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export const pokeball = {
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const pokeball: SimpleTranslationEntries = {
|
||||||
"pokeBall": "Poké Ball",
|
"pokeBall": "Poké Ball",
|
||||||
"greatBall": "Super Ball",
|
"greatBall": "Super Ball",
|
||||||
"ultraBall": "Hyper Ball",
|
"ultraBall": "Hyper Ball",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,6 @@
|
||||||
export const menu = {
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const menu: SimpleTranslationEntries = {
|
||||||
"cancel": "Annulla",
|
"cancel": "Annulla",
|
||||||
"continue": "Continua",
|
"continue": "Continua",
|
||||||
"newGame": "Nuova Partita",
|
"newGame": "Nuova Partita",
|
||||||
|
|
|
@ -142,7 +142,7 @@ class AddPokeballModifierType extends ModifierType implements Localizable {
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
localize() {
|
localize(): void {
|
||||||
this.name = `${this.count}x ${getPokeballName(this.pokeballType)}`;
|
this.name = `${this.count}x ${getPokeballName(this.pokeballType)}`;
|
||||||
this.description = `Receive ${getPokeballName(this.pokeballType)} x${this.count}\nCatch Rate: ${getPokeballCatchMultiplier(this.pokeballType) > -1 ? `${getPokeballCatchMultiplier(this.pokeballType)}x` : 'Certain'}`;
|
this.description = `Receive ${getPokeballName(this.pokeballType)} x${this.count}\nCatch Rate: ${getPokeballCatchMultiplier(this.pokeballType) > -1 ? `${getPokeballCatchMultiplier(this.pokeballType)}x` : 'Certain'}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,19 @@ import { move as frMove } from '../locales/fr/move';
|
||||||
import { pokeball as enPokeball } from '../locales/en/pokeball';
|
import { pokeball as enPokeball } from '../locales/en/pokeball';
|
||||||
import { pokeball as frPokeball } from '../locales/fr/pokeball';
|
import { pokeball as frPokeball } from '../locales/fr/pokeball';
|
||||||
|
|
||||||
|
import { pokemon as enPokemon } from '../locales/en/pokemon';
|
||||||
|
import { pokemon as frPokemon } from '../locales/fr/pokemon';
|
||||||
|
|
||||||
|
export interface SimpleTranslationEntries {
|
||||||
|
[key: string]: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface MoveTranslationEntry {
|
export interface MoveTranslationEntry {
|
||||||
name: string,
|
name: string,
|
||||||
effect: string
|
effect: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MoveTranslations {
|
export interface MoveTranslationEntries {
|
||||||
[key: string]: MoveTranslationEntry
|
[key: string]: MoveTranslationEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +61,7 @@ export function initI18n(): void {
|
||||||
menu: enMenu,
|
menu: enMenu,
|
||||||
move: enMove,
|
move: enMove,
|
||||||
pokeball: enPokeball,
|
pokeball: enPokeball,
|
||||||
|
pokemon: enPokemon,
|
||||||
},
|
},
|
||||||
it: {
|
it: {
|
||||||
menu: itMenu,
|
menu: itMenu,
|
||||||
|
@ -62,6 +70,7 @@ export function initI18n(): void {
|
||||||
menu: frMenu,
|
menu: frMenu,
|
||||||
move: frMove,
|
move: frMove,
|
||||||
pokeball: frPokeball,
|
pokeball: frPokeball,
|
||||||
|
pokemon: frPokemon,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -74,6 +83,7 @@ declare module 'i18next' {
|
||||||
menu: typeof enMenu;
|
menu: typeof enMenu;
|
||||||
move: typeof enMove;
|
move: typeof enMove;
|
||||||
pokeball: typeof enPokeball;
|
pokeball: typeof enPokeball;
|
||||||
|
pokemon: typeof enPokemon;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue