command-ui: add i18n for command ui handler and add i18n for fr (#258)
* command-ui: add i18n for command ui handler and add i18n for fr * Add missing Spanish file * Add additional missing localization references --------- Co-authored-by: Flashfyre <flashfireex@gmail.com>pull/268/head
parent
ea40bd18f5
commit
1b1578d266
|
@ -0,0 +1,9 @@
|
|||
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||
|
||||
export const commandUiHandler: SimpleTranslationEntries = {
|
||||
"fight": "Fight",
|
||||
"ball": "Ball",
|
||||
"pokemon": "Pokémon",
|
||||
"run": "Run",
|
||||
"actionMessage": "What will\n{{pokemonName}} do?",
|
||||
} as const;
|
|
@ -0,0 +1,9 @@
|
|||
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||
|
||||
export const commandUiHandler: SimpleTranslationEntries = {
|
||||
"fight": "Fight",
|
||||
"ball": "Ball",
|
||||
"pokemon": "Pokémon",
|
||||
"run": "Run",
|
||||
"actionMessage": "What will\n{{pokemonName}} do?",
|
||||
} as const;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,9 @@
|
|||
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||
|
||||
export const commandUiHandler: SimpleTranslationEntries = {
|
||||
"fight": "Attaque",
|
||||
"ball": "Ball",
|
||||
"pokemon": "Pokémon",
|
||||
"run": "Fuite",
|
||||
"actionMessage": "Que doit faire\n{{pokemonName}}?",
|
||||
} as const;
|
|
@ -13,12 +13,18 @@ import { pokeball as esPokeball } from '../locales/es/pokeball';
|
|||
import { pokeball as frPokeball } from '../locales/fr/pokeball';
|
||||
|
||||
import { pokemon as enPokemon } from '../locales/en/pokemon';
|
||||
import { pokemon as esPokemon } from '../locales/es/pokemon';
|
||||
import { pokemon as frPokemon } from '../locales/fr/pokemon';
|
||||
|
||||
import { commandUiHandler as enCommandUiHandler } from '../locales/en/command-ui-handler';
|
||||
import { commandUiHandler as esCommandUiHandler } from '../locales/es/command-ui-handler';
|
||||
import { commandUiHandler as frCommandUiHandler } from '../locales/fr/command-ui-handler';
|
||||
|
||||
export interface SimpleTranslationEntries {
|
||||
[key: string]: string
|
||||
}
|
||||
|
||||
|
||||
export interface MoveTranslationEntry {
|
||||
name: string,
|
||||
effect: string
|
||||
|
@ -65,21 +71,25 @@ export function initI18n(): void {
|
|||
move: enMove,
|
||||
pokeball: enPokeball,
|
||||
pokemon: enPokemon,
|
||||
commandUiHandler: enCommandUiHandler,
|
||||
},
|
||||
es: {
|
||||
menu: esMenu,
|
||||
move: esMove,
|
||||
pokeball: esPokeball,
|
||||
},
|
||||
it: {
|
||||
menu: itMenu,
|
||||
pokemon: esPokemon,
|
||||
commandUiHandler: esCommandUiHandler,
|
||||
},
|
||||
fr: {
|
||||
menu: frMenu,
|
||||
move: frMove,
|
||||
pokeball: frPokeball,
|
||||
pokemon: frPokemon,
|
||||
}
|
||||
commandUiHandler: frCommandUiHandler,
|
||||
},
|
||||
it: {
|
||||
menu: itMenu,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -92,6 +102,7 @@ declare module 'i18next' {
|
|||
move: typeof enMove;
|
||||
pokeball: typeof enPokeball;
|
||||
pokemon: typeof enPokemon;
|
||||
commandUiHandler: typeof enCommandUiHandler;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import { addTextObject, TextStyle } from "./text";
|
|||
import PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
|
||||
import { Mode } from "./ui";
|
||||
import UiHandler from "./ui-handler";
|
||||
import i18next from '../plugins/i18n';
|
||||
|
||||
export enum Command {
|
||||
FIGHT = 0,
|
||||
|
@ -25,7 +26,12 @@ export default class CommandUiHandler extends UiHandler {
|
|||
|
||||
setup() {
|
||||
const ui = this.getUi();
|
||||
const commands = [ 'Fight', 'Ball', 'Pokémon', 'Run' ];
|
||||
const commands = [
|
||||
i18next.t('commandUiHandler:fight'),
|
||||
i18next.t('commandUiHandler:ball'),
|
||||
i18next.t('commandUiHandler:pokemon'),
|
||||
i18next.t('commandUiHandler:run')
|
||||
];
|
||||
|
||||
this.commandsContainer = this.scene.add.container(216, -38.7);
|
||||
this.commandsContainer.setVisible(false);
|
||||
|
@ -55,7 +61,7 @@ export default class CommandUiHandler extends UiHandler {
|
|||
messageHandler.commandWindow.setVisible(true);
|
||||
messageHandler.movesWindowContainer.setVisible(false);
|
||||
messageHandler.message.setWordWrapWidth(1110);
|
||||
messageHandler.showText(`What will\n${commandPhase.getPokemon().name} do?`, 0);
|
||||
messageHandler.showText(i18next.t('commandUiHandler:actionMessage', {pokemonName: commandPhase.getPokemon().name}), 0);
|
||||
this.setCursor(this.getCursor());
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue