From 1d29ee6d87d3794a9319bca5bf36afdfe176072c Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 1 Sep 2023 22:32:45 +0200 Subject: translations with fallback --- resources/js/story.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'resources/js/story.js') diff --git a/resources/js/story.js b/resources/js/story.js index 0ceb224..d5e6486 100644 --- a/resources/js/story.js +++ b/resources/js/story.js @@ -20,9 +20,9 @@ const Story = { const npcCeo = await fetchNpc(characterCeo.slug); const npcShopKeeper = await fetchNpc(characterShopKeeper.slug); - await UI.buildAndShowStoryPopup({ speaker: npcCeo, text: translate(characterCeo.text[0], true) }); - await UI.buildAndShowStoryPopup({ speaker: npcCeo, text: translate(characterCeo.text[1], true) }); - await UI.buildAndShowStoryPopup({ speaker: npcShopKeeper, text: translate(characterShopKeeper.text[0], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcCeo, text: translate(characterCeo.text[0]) }); + await UI.buildAndShowStoryPopup({ speaker: npcCeo, text: translate(characterCeo.text[1]) }); + await UI.buildAndShowStoryPopup({ speaker: npcShopKeeper, text: translate(characterShopKeeper.text[0]) }); const possibleStarterMonsters = await Promise.all( story.monsters.map(async (monsterData) => { @@ -32,7 +32,7 @@ const Story = { }) ); - const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:introduction:monster_selection:title', true) }); + const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:introduction:monster_selection:title') }); await new Promise((resolve) => { monsterSelection.addEventListener('starter:monster:selected', UI.wrapCallback(async (event) => { if (!confirm(`Select ${event.detail.monster.name}?`)) { @@ -41,7 +41,7 @@ const Story = { event.detail.popup.remove(); - await UI.buildAndShowStoryPopup({ speaker: npcShopKeeper, text: translate(characterShopKeeper.text[1], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcShopKeeper, text: translate(characterShopKeeper.text[1]) }); // set rival monster Memory.state.rivalMonster = event.detail.monster.slug; @@ -62,9 +62,9 @@ const Story = { const characterDante = story.characters.dante; const npcDante = await fetchNpc(characterDante.slug); - await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[0], true) }); - await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[1], true) }); - await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[2], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[0]) }); + await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[1]) }); + await UI.buildAndShowStoryPopup({ speaker: npcDante, text: translate(characterDante.text[2]) }); const possibleStarterMonsters = await Promise.all( story.monsters.map(async (monsterData) => { @@ -74,7 +74,7 @@ const Story = { }) ); - const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:select_starter_monster:monster_selection:title', true) }); + const monsterSelection = UI.openStarterMonsterSelection(possibleStarterMonsters, { title: translate('story:select_starter_monster:monster_selection:title') }); await new Promise((resolve) => { monsterSelection.addEventListener('starter:monster:selected', UI.wrapCallback(async (event) => { if (!confirm(`Select ${event.detail.monster.name}?`)) { @@ -117,17 +117,17 @@ const Story = { }); await Memory.state.opponent.initialize(); - await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[0], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[0]) }); await Story.battle(); if (Game.didWinStoryBattle) { - await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[1], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[1]) }); } else { - await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[2], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[2]) }); } - await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[3], true) }); + await UI.buildAndShowStoryPopup({ speaker: npcRival, text: translate(characterRival.text[3]) }); Game.healParty(); }, -- cgit v1.2.3