Implement localisation for tutorial (#330)

* Implement localisation for tutorial

* Fix modules name

* Fix keys name

* Fix keys name part 2 : the return

* Add lines breaks in localisation files
This commit is contained in:
Thomas David 2024-04-29 18:33:18 +02:00 committed by GitHub
parent 3b83d0b4d9
commit 9575054010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 211 additions and 29 deletions

View File

@ -0,0 +1,38 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const tutorial: SimpleTranslationEntries = {
"intro": `Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`,
"accessMenu": `To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`,
"menu": `From this menu you can access the settings.
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`,
"starterSelect": `From this screen, you can select your starters.\nThese are your initial party members.
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`,
"pokerus": `A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`,
"selectItem": `After every battle, you are given a choice of 3 random items.\nYou may only pick one.
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`,
"eggGacha": `From this screen, you can redeem your vouchers for\nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`,
} as const;

View File

@ -0,0 +1,38 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const tutorial: SimpleTranslationEntries = {
"intro": `Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`,
"accessMenu": `To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`,
"menu": `From this menu you can access the settings.
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`,
"starterSelect": `From this screen, you can select your starters.\nThese are your initial party members.
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`,
"pokerus": `A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`,
"selectItem": `After every battle, you are given a choice of 3 random items.\nYou may only pick one.
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`,
"eggGacha": `From this screen, you can redeem your vouchers for\nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`,
} as const;

View File

@ -0,0 +1,38 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const tutorial: SimpleTranslationEntries = {
"intro": `Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`,
"accessMenu": `To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`,
"menu": `From this menu you can access the settings.
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`,
"starterSelect": `From this screen, you can select your starters.\nThese are your initial party members.
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`,
"pokerus": `A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`,
"selectItem": `After every battle, you are given a choice of 3 random items.\nYou may only pick one.
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`,
"eggGacha": `From this screen, you can redeem your vouchers for\nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`,
} as const;

View File

@ -0,0 +1,38 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const tutorial: SimpleTranslationEntries = {
"intro": `Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`,
"accessMenu": `To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`,
"menu": `From this menu you can access the settings.
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`,
"starterSelect": `From this screen, you can select your starters.\nThese are your initial party members.
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`,
"pokerus": `A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`,
"selectItem": `After every battle, you are given a choice of 3 random items.\nYou may only pick one.
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`,
"eggGacha": `From this screen, you can redeem your vouchers for\nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`,
} as const;

View File

@ -0,0 +1,38 @@
import { SimpleTranslationEntries } from "#app/plugins/i18n";
export const tutorial: SimpleTranslationEntries = {
"intro": `Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`,
"accessMenu": `To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`,
"menu": `From this menu you can access the settings.
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`,
"starterSelect": `From this screen, you can select your starters.\nThese are your initial party members.
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`,
"pokerus": `A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`,
"selectItem": `After every battle, you are given a choice of 3 random items.\nYou may only pick one.
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`,
"eggGacha": `From this screen, you can redeem your vouchers for\nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`,
} as const;

View File

@ -45,6 +45,12 @@ import { commandUiHandler as deCommandUiHandler } from '../locales/de/command-ui
import { fightUiHandler as enFightUiHandler } from '../locales/en/fight-ui-handler'; import { fightUiHandler as enFightUiHandler } from '../locales/en/fight-ui-handler';
import { fightUiHandler as frFightUiHandler } from '../locales/fr/fight-ui-handler'; import { fightUiHandler as frFightUiHandler } from '../locales/fr/fight-ui-handler';
import { tutorial as enTutorial } from '../locales/en/tutorial';
import { tutorial as esTutorial } from '../locales/es/tutorial';
import { tutorial as frTutorial } from '../locales/fr/tutorial';
import { tutorial as itTutorial} from '../locales/it/tutorial';
import { tutorial as deTutorial } from '../locales/de/tutorial';
export interface SimpleTranslationEntries { export interface SimpleTranslationEntries {
[key: string]: string [key: string]: string
} }
@ -113,6 +119,7 @@ export function initI18n(): void {
pokemonStat: enPokemonStat, pokemonStat: enPokemonStat,
commandUiHandler: enCommandUiHandler, commandUiHandler: enCommandUiHandler,
fightUiHandler: enFightUiHandler, fightUiHandler: enFightUiHandler,
tutorial: enTutorial,
}, },
es: { es: {
menu: esMenu, menu: esMenu,
@ -123,6 +130,7 @@ export function initI18n(): void {
pokemon: esPokemon, pokemon: esPokemon,
pokemonStat: esPokemonStat, pokemonStat: esPokemonStat,
commandUiHandler: esCommandUiHandler, commandUiHandler: esCommandUiHandler,
tutorial: esTutorial,
}, },
fr: { fr: {
menu: frMenu, menu: frMenu,
@ -134,11 +142,13 @@ export function initI18n(): void {
pokemonStat: frPokemonStat, pokemonStat: frPokemonStat,
commandUiHandler: frCommandUiHandler, commandUiHandler: frCommandUiHandler,
fightUiHandler: frFightUiHandler, fightUiHandler: frFightUiHandler,
tutorial: frTutorial,
}, },
it: { it: {
menu: itMenu, menu: itMenu,
menuUiHandler: itMenuUiHandler, menuUiHandler: itMenuUiHandler,
pokemonStat: itPokemonStat, pokemonStat: itPokemonStat,
tutorial: itTutorial,
}, },
de: { de: {
menu: deMenu, menu: deMenu,
@ -149,6 +159,7 @@ export function initI18n(): void {
pokemon: dePokemon, pokemon: dePokemon,
pokemonStat: dePokemonStat, pokemonStat: dePokemonStat,
commandUiHandler: deCommandUiHandler, commandUiHandler: deCommandUiHandler,
tutorial: deTutorial,
} }
}, },
}); });
@ -167,6 +178,7 @@ declare module 'i18next' {
pokemonStat: typeof enPokemonStat; pokemonStat: typeof enPokemonStat;
commandUiHandler: typeof enCommandUiHandler; commandUiHandler: typeof enCommandUiHandler;
fightUiHandler: typeof enFightUiHandler; fightUiHandler: typeof enFightUiHandler;
tutorial: typeof enTutorial;
}; };
} }
} }

View File

@ -1,6 +1,7 @@
import BattleScene from "./battle-scene"; import BattleScene from "./battle-scene";
import AwaitableUiHandler from "./ui/awaitable-ui-handler"; import AwaitableUiHandler from "./ui/awaitable-ui-handler";
import { Mode } from "./ui/ui"; import { Mode } from "./ui/ui";
import i18next from './plugins/i18n';
export enum Tutorial { export enum Tutorial {
Intro = "INTRO", Intro = "INTRO",
@ -15,63 +16,42 @@ export enum Tutorial {
const tutorialHandlers = { const tutorialHandlers = {
[Tutorial.Intro]: (scene: BattleScene) => { [Tutorial.Intro]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.ui.showText(`Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements. scene.ui.showText(i18next.t("tutorial:intro"), null, () => resolve(), null, true);
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used.
$The game is a work in progress, but fully playable.\nFor bug reports, please use the Discord community.
$If the game runs slowly, please ensure 'Hardware Acceleration' is turned on in your browser settings.`, null, () => resolve(), null, true);
}); });
}, },
[Tutorial.Access_Menu]: (scene: BattleScene) => { [Tutorial.Access_Menu]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
if (scene.enableTouchControls) if (scene.enableTouchControls)
return resolve(); return resolve();
scene.showFieldOverlay(1000).then(() => scene.ui.showText(`To access the menu, press M or Escape while awaiting input.\nThe menu contains settings and various features.`, null, () => scene.hideFieldOverlay(1000).then(() => resolve()), null, true)); scene.showFieldOverlay(1000).then(() => scene.ui.showText(i18next.t("tutorial:accessMenu"), null, () => scene.hideFieldOverlay(1000).then(() => resolve()), null, true));
}); });
}, },
[Tutorial.Menu]: (scene: BattleScene) => { [Tutorial.Menu]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.gameData.saveTutorialFlag(Tutorial.Access_Menu, true); scene.gameData.saveTutorialFlag(Tutorial.Access_Menu, true);
scene.ui.showText(`From this menu you can access the settings. scene.ui.showText(i18next.t("tutorial:menu"), null, () => scene.ui.showText('', null, () => resolve()), null, true);
$From the settings you can change game speed, window style, and other options.
$There are also various other features here, so be sure to check them all!`, null, () => scene.ui.showText('', null, () => resolve()), null, true);
}); });
}, },
[Tutorial.Starter_Select]: (scene: BattleScene) => { [Tutorial.Starter_Select]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.ui.showText(`From this screen, you can select your starters.\nThese are your initial party members. scene.ui.showText(i18next.t("tutorial:starterSelect"), null, () => scene.ui.showText('', null, () => resolve()), null, true);
$Each starter has a value. Your party can have up to\n6 members as long as the total does not exceed 10.
$You can also select gender, ability, and form depending on\nthe variants you've caught or hatched.
$The IVs for a species are also the best of every one you've\ncaught or hatched, so try to get lots of the same species!`, null, () => scene.ui.showText('', null, () => resolve()), null, true);
}); });
}, },
[Tutorial.Pokerus]: (scene: BattleScene) => { [Tutorial.Pokerus]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.ui.showText(`A daily random 3 selectable starters have a purple border. scene.ui.showText(i18next.t("tutorial:pokerus"), null, () => scene.ui.showText('', null, () => resolve()), null, true);
$If you see a starter you own with one of these,\ntry adding it to your party. Be sure to check its summary!`, null, () => scene.ui.showText('', null, () => resolve()), null, true);
}); });
}, },
[Tutorial.Select_Item]: (scene: BattleScene) => { [Tutorial.Select_Item]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.ui.setModeWithoutClear(Mode.MESSAGE).then(() => { scene.ui.setModeWithoutClear(Mode.MESSAGE).then(() => {
scene.ui.showText(`After every battle, you are given a choice of 3 random items.\nYou may only pick one. scene.ui.showText(i18next.t("tutorial:selectItem"), null, () => scene.ui.showText('', null, () => scene.ui.setModeWithoutClear(Mode.MODIFIER_SELECT).then(() => resolve())), null, true);
$These range from consumables, to Pokémon held items, to passive permanent items.
$Most non-consumable item effects will stack in various ways.
$Some items will only show up if they can be used, such as evolution items.
$You can also transfer held items between Pokémon using the transfer option.
$The transfer option will appear in the bottom right once you have obtained a held item.
$You may purchase consumable items with money, and a larger variety will be available the further you get.
$Be sure to buy these before you pick your random item, as it will progress to the next battle once you do.`, null, () => scene.ui.showText('', null, () => scene.ui.setModeWithoutClear(Mode.MODIFIER_SELECT).then(() => resolve())), null, true);
}); });
}); });
}, },
[Tutorial.Egg_Gacha]: (scene: BattleScene) => { [Tutorial.Egg_Gacha]: (scene: BattleScene) => {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
scene.ui.showText(`From this screen, you can redeem your vouchers for\nPokémon eggs. scene.ui.showText(i18next.t("tutorial:eggGacha"), null, () => scene.ui.showText('', null, () => resolve()), null, true);
$Eggs have to be hatched and get closer to hatching after\nevery battle. Rarer eggs take longer to hatch.
$Hatched Pokémon also won't be added to your party, they will\nbe added to your starters.
$Pokémon hatched from eggs generally have better IVs than\nwild Pokémon.
$Some Pokémon can only even be obtained from eggs.
$There are 3 different machines to pull from with different\nbonuses, so pick the one that suits you best!`, null, () => scene.ui.showText('', null, () => resolve()), null, true);
}); });
}, },
}; };
@ -94,4 +74,4 @@ export function handleTutorial(scene: BattleScene, tutorial: Tutorial): Promise<
resolve(true); resolve(true);
}); });
}); });
} }