diff --git a/lambda/custom/index.js b/lambda/custom/index.js index 49312e4..0bbd0a7 100755 --- a/lambda/custom/index.js +++ b/lambda/custom/index.js @@ -6,6 +6,7 @@ const recipes = require('./recipes'); const i18n = require('i18next'); const sprintf = require('i18next-sprintf-postprocessor'); + /* INTENT HANDLERS */ const LaunchRequestHandler = { canHandle(handlerInput) { @@ -163,52 +164,10 @@ const ErrorHandler = { /* CONSTANTS */ const skillBuilder = Alexa.SkillBuilders.custom(); const languageStrings = { - en: { - translation: { - RECIPES: recipes.RECIPE_EN_US, - SKILL_NAME: 'Minecraft Helper', - WELCOME_MESSAGE: 'Welcome to %s. You can ask a question like, what\'s the recipe for a %s? ... Now, what can I help you with?', - WELCOME_REPROMPT: 'For instructions on what you can say, please say help me.', - DISPLAY_CARD_TITLE: '%s - Recipe for %s.', - HELP_MESSAGE: 'You can ask questions such as, what\'s the recipe for a %s, or, you can say exit...Now, what can I help you with?', - HELP_REPROMPT: 'You can say things like, what\'s the recipe for a %s, or you can say exit...Now, what can I help you with?', - STOP_MESSAGE: 'Goodbye!', - RECIPE_REPEAT_MESSAGE: 'Try saying repeat.', - RECIPE_NOT_FOUND_MESSAGE: 'I\'m sorry, I currently do not know ', - RECIPE_NOT_FOUND_WITH_ITEM_NAME: 'the recipe for %s. ', - RECIPE_NOT_FOUND_WITHOUT_ITEM_NAME: 'that recipe. ', - RECIPE_NOT_FOUND_REPROMPT: 'What else can I help with?' - }, - }, - 'en-US': { - translation: { - RECIPES: recipes.RECIPE_EN_US, - SKILL_NAME: 'American Minecraft Helper' - }, - }, - 'en-GB': { - translation: { - RECIPES: recipes.RECIPE_EN_GB, - SKILL_NAME: 'British Minecraft Helper' - }, - }, - de: { - translation: { - RECIPES: recipes.RECIPE_DE_DE, - SKILL_NAME: 'Assistent für Minecraft in Deutsch', - WELCOME_MESSAGE: 'Willkommen bei %s. Du kannst beispielsweise die Frage stellen: Welche Rezepte gibt es für eine %s? ... Nun, womit kann ich dir helfen?', - WELCOME_REPROMPT: 'Wenn du wissen möchtest, was du sagen kannst, sag einfach „Hilf mir“.', - DISPLAY_CARD_TITLE: '%s - Rezept für %s.', - HELP_MESSAGE: 'Du kannst beispielsweise Fragen stellen wie „Wie geht das Rezept für eine %s“ oder du kannst „Beenden“ sagen ... Wie kann ich dir helfen?', - HELP_REPROMPT: 'Du kannst beispielsweise Sachen sagen wie „Wie geht das Rezept für eine %s“ oder du kannst „Beenden“ sagen ... Wie kann ich dir helfen?', - STOP_MESSAGE: 'Auf Wiedersehen!', - RECIPE_REPEAT_MESSAGE: 'Sage einfach „Wiederholen“.', - RECIPE_NOT_FOUND_MESSAGE: 'Tut mir leid, ich kenne derzeit ', - RECIPE_NOT_FOUND_WITH_ITEM_NAME: 'das Rezept für %s nicht. ', - RECIPE_NOT_FOUND_WITHOUT_ITEM_NAME: 'dieses Rezept nicht. ', - RECIPE_NOT_FOUND_REPROMPT: 'Womit kann ich dir sonst helfen?' - }, - }, + 'en': require('languages/en.js'), + 'en-US': require('languages/en-US.js'), + 'en-GB': require('languages/en-GB.js'), + 'de': require('languages/de.js') }; // Finding the locale of the user diff --git a/lambda/custom/languages/de.js b/lambda/custom/languages/de.js new file mode 100644 index 0000000..12e4c62 --- /dev/null +++ b/lambda/custom/languages/de.js @@ -0,0 +1,21 @@ +const recipes = require('../recipes'); +const i18n = require('i18next'); +const sprintf = require('i18next-sprintf-postprocessor'); + +module.exports = { + translation: { + RECIPES: recipes.RECIPE_DE_DE, + SKILL_NAME: 'Assistent für Minecraft in Deutsch', + WELCOME_MESSAGE: 'Willkommen bei %s. Du kannst beispielsweise die Frage stellen: Welche Rezepte gibt es für eine %s? ... Nun, womit kann ich dir helfen?', + WELCOME_REPROMPT: 'Wenn du wissen möchtest, was du sagen kannst, sag einfach „Hilf mir“.', + DISPLAY_CARD_TITLE: '%s - Rezept für %s.', + HELP_MESSAGE: 'Du kannst beispielsweise Fragen stellen wie „Wie geht das Rezept für eine %s“ oder du kannst „Beenden“ sagen ... Wie kann ich dir helfen?', + HELP_REPROMPT: 'Du kannst beispielsweise Sachen sagen wie „Wie geht das Rezept für eine %s“ oder du kannst „Beenden“ sagen ... Wie kann ich dir helfen?', + STOP_MESSAGE: 'Auf Wiedersehen!', + RECIPE_REPEAT_MESSAGE: 'Sage einfach „Wiederholen“.', + RECIPE_NOT_FOUND_MESSAGE: 'Tut mir leid, ich kenne derzeit ', + RECIPE_NOT_FOUND_WITH_ITEM_NAME: 'das Rezept für %s nicht. ', + RECIPE_NOT_FOUND_WITHOUT_ITEM_NAME: 'dieses Rezept nicht. ', + RECIPE_NOT_FOUND_REPROMPT: 'Womit kann ich dir sonst helfen?' + } +} diff --git a/lambda/custom/languages/en-GB.js b/lambda/custom/languages/en-GB.js new file mode 100644 index 0000000..e6d1ad3 --- /dev/null +++ b/lambda/custom/languages/en-GB.js @@ -0,0 +1,10 @@ +const recipes = require('../recipes'); +const i18n = require('i18next'); +const sprintf = require('i18next-sprintf-postprocessor'); + +module.exports = { + translation: { + RECIPES: recipes.RECIPE_EN_GB, + SKILL_NAME: 'British Minecraft Helper' + } +} diff --git a/lambda/custom/languages/en-US.js b/lambda/custom/languages/en-US.js new file mode 100644 index 0000000..c5db2a2 --- /dev/null +++ b/lambda/custom/languages/en-US.js @@ -0,0 +1,10 @@ +const recipes = require('../recipes'); +const i18n = require('i18next'); +const sprintf = require('i18next-sprintf-postprocessor'); + +module.exports = { + translation: { + RECIPES: recipes.RECIPE_EN_US, + SKILL_NAME: 'American Minecraft Helper' + } +} diff --git a/lambda/custom/languages/en.js b/lambda/custom/languages/en.js new file mode 100644 index 0000000..8c23365 --- /dev/null +++ b/lambda/custom/languages/en.js @@ -0,0 +1,21 @@ +const recipes = require('../recipes'); +const i18n = require('i18next'); +const sprintf = require('i18next-sprintf-postprocessor'); + +module.exports = { + translation: { + RECIPES: recipes.RECIPE_EN_US, + SKILL_NAME: 'Minecraft Helper', + WELCOME_MESSAGE: 'Welcome to %s. You can ask a question like, what\'s the recipe for a %s? ... Now, what can I help you with?', + WELCOME_REPROMPT: 'For instructions on what you can say, please say help me.', + DISPLAY_CARD_TITLE: '%s - Recipe for %s.', + HELP_MESSAGE: 'You can ask questions such as, what\'s the recipe for a %s, or, you can say exit...Now, what can I help you with?', + HELP_REPROMPT: 'You can say things like, what\'s the recipe for a %s, or you can say exit...Now, what can I help you with?', + STOP_MESSAGE: 'Goodbye!', + RECIPE_REPEAT_MESSAGE: 'Try saying repeat.', + RECIPE_NOT_FOUND_MESSAGE: 'I\'m sorry, I currently do not know ', + RECIPE_NOT_FOUND_WITH_ITEM_NAME: 'the recipe for %s. ', + RECIPE_NOT_FOUND_WITHOUT_ITEM_NAME: 'that recipe. ', + RECIPE_NOT_FOUND_REPROMPT: 'What else can I help with?' + } +}