Skip to content

Commit

Permalink
Add audio and images to translations
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtuckerphx committed Feb 17, 2017
1 parent ef542be commit 21ea3f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/factsHelper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';
const _ = require('lodash');
const util = require('./util');
const Config = require('./config/skill.config');

module.exports = (function () {
return {
Expand All @@ -18,12 +19,14 @@ module.exports = (function () {
let title = this.t('getFact.title', index + 1);
let speechOutput = title + ': ' + item + reprompt;
let cardContent = util.replaceTags(item);
let cardImages = this.t('getFact.cardImages', Config.s3.bucketName);

let response = {
speechOutput: speechOutput,
reprompt: reprompt,
cardTitle: title,
cardContent: cardContent
cardContent: cardContent,
cardImages: cardImages
};

return response;
Expand Down
10 changes: 5 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ var mainHandlers = {
if (isNewSession) {

//VI-REMOVE:VoiceInsights.track(intent.name, null, ssmlResponse.speechOutput, (error, response) => {
this.emit(':tellWithCard', ssmlResponse.speechOutput, ssmlResponse.cardTitle, ssmlResponse.cardContent);
this.emit(':tellWithCard', ssmlResponse.speechOutput, ssmlResponse.cardTitle, ssmlResponse.cardContent, ssmlResponse.cardImages);
//VI-REMOVE:});
}
else {

//VI-REMOVE:VoiceInsights.track(intent.name, null, ssmlResponse.speechOutput, (error, response) => {
this.emit(':askWithCard', ssmlResponse.speechOutput, ssmlResponse.reprompt, ssmlResponse.cardTitle, ssmlResponse.cardContent);
this.emit(':askWithCard', ssmlResponse.speechOutput, ssmlResponse.reprompt, ssmlResponse.cardTitle, ssmlResponse.cardContent, ssmlResponse.cardImages);
//VI-REMOVE:});
}
}
Expand Down Expand Up @@ -147,13 +147,13 @@ var mainHandlers = {
if (isNewSession) {

//VI-REMOVE:VoiceInsights.track(intent.name, intent.slots, ssmlResponse.speechOutput, (error, response) => {
this.emit(':tellWithCard', ssmlResponse.speechOutput, ssmlResponse.cardTitle, ssmlResponse.cardContent);
this.emit(':tellWithCard', ssmlResponse.speechOutput, ssmlResponse.cardTitle, ssmlResponse.cardContent, ssmlResponse.cardImages);
//VI-REMOVE:});
}
else {

//VI-REMOVE:VoiceInsights.track(intent.name, intent.slots, ssmlResponse.speechOutput, (error, response) => {
this.emit(':askWithCard', ssmlResponse.speechOutput, ssmlResponse.reprompt, ssmlResponse.cardTitle, ssmlResponse.cardContent);
this.emit(':askWithCard', ssmlResponse.speechOutput, ssmlResponse.reprompt, ssmlResponse.cardTitle, ssmlResponse.cardContent, ssmlResponse.cardImages);
//VI-REMOVE:});
}
}
Expand Down Expand Up @@ -209,7 +209,7 @@ var mainHandlers = {

'SessionEndedRequest': function () {

let ssmlResponse = this.t('goodbye');
let ssmlResponse = this.t('goodbye', Config.s3.bucketName);

AttributesHelper.clearRepeat.call(this);

Expand Down
8 changes: 6 additions & 2 deletions src/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"reprompt": "If you are not sure what to ask, say help. To end, you can say: stop."
},
"goodbye": {
"speechOutput": "Goodbye and Thank you!"
"speechOutput": "Goodbye and Thank you! <audio src='https://s3.amazonaws.com/%s/audio/beam.mp3' />"
},
"facts": [
"Cows go moo",
Expand All @@ -43,7 +43,11 @@
],
"getFact": {
"title": "Fact %d",
"invalidIndex": "I cannot find fact %d. Currently, I have %d facts that I can share. Please ask for a different fact number, a new fact, or give me a different instruction."
"invalidIndex": "I cannot find fact %d. Currently, I have %d facts that I can share. Please ask for a different fact number, a new fact, or give me a different instruction.",
"cardImages": {
"smallImageUrl": "https://s3.amazonaws.com/%s/images/image_small.jpg",
"largeImageUrl": "https://s3.amazonaws.com/%s/images/image_large.jpg"
}
}
}
}
Expand Down

0 comments on commit 21ea3f1

Please sign in to comment.