AlexaDev Tuesday: International Alexa Skills

Alexa devices are already available in the US, UK and Germany, and Amazon has just announced its intention to release them in India and Japan as well. Fortunately, Amazon makes it easy for devs to release international Alexa skills in foreign countries. In India and the UK, you don’t even have to know a foreign language.

 

Meddling With Foreign Languages

 

English is one of the primary supported languages for Alexa skills released in the UK and India, though the Alexa ‘dictionary’ for those regions is slightly different than that for American English. The steps to make in-development skills available internationally, or to make your existing skills available overseas, are fairly simple.

 

1. In the Developer portal, make required entries in the Add A New Language tab.
There are really just three fields to update here. First, you select the foreign language you want to support. Then, you specify your desired skill name and invocation name. These may be the same as your American English version, or you might want to tweak them to better suit the foreign region.

 

2. Update your Lambda function (or other codebase) to include a languageStrings object.
The languageStrings object contains JSON name:value pairs for any different versions of spoken skill outputs you’d like to provide. If you don’t provide different versions for different regions, the primary (‘en’) versions will be used by default.

Your JSON pairs can include slightly different English language versions of your desired output speech, or if you know the foreign language of the target region (e.g., Germany), you can provide actual foreign language content. Here’s an example from the ‘Space Facts’ sample Amazon skill:


const languageStrings = {
‘en’: {
translation: {
SKILL_NAME: ‘Space Facts’,
GET_FACT_MESSAGE: “Here’s your fact: “,
HELP_MESSAGE: ‘You can say tell me a space fact, or, you can say exit… What can I help you with?’,
HELP_REPROMPT: ‘What can I help you with?’,
STOP_MESSAGE: ‘Goodbye!’,
},
},
‘en-US’: {
translation: {
SKILL_NAME: ‘American Space Facts’,
},
},
‘en-GB’: {
translation: {

SKILL_NAME: ‘British Space Facts’,
},
},
‘de’: {
translation: {
SKILL_NAME: ‘Weltraumwissen auf Deutsch’,
GET_FACT_MESSAGE: ‘Hier sind deine Fakten: ‘,
HELP_MESSAGE: ‘Du kannst sagen, „Nenne mir einen Fakt über den Weltraum“, oder du kannst „Beenden“ sagen… Wie kann ich dir helfen?’,
HELP_REPROMPT: ‘Wie kann ich dir helfen?’,
STOP_MESSAGE: ‘Auf Wiedersehen!’,
},
},
};


 

3. Update your Lambda function (or other codebase) exports handler code to include the new languageStrings object.
Here’s the exports handler code that goes with the languageStrings code above:


exports.handler = function (event, context) {
// Prints Request Event in CloudWatch Logs
console.log(“===EVENT=== \n” + JSON.stringify(event));

const alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
// To enable string internationalization (i18n) features, set a resources object.
alexa.resources = languageStrings;
alexa.registerHandlers(handlers);
alexa.execute();
};


 

4. Update your Lambda function (or other codebase) to access the languageStrings object as needed by reference.
See the example below.


‘HelloWorldIntent’: function () {
speechOutput = this.t()
this.response.speak(speechOutput);
this.response.cardRenderer(this.t(‘SKILL_NAME’), speechOutput);
this.emit(‘:responseReady’);
}


That’s it. Save your changes and you’re done.

 

Will Releasing An Updated Version Of The Skill Negatively Impact My Earnings?
Those who have Alexa skills that earn them money based on user engagement may be leery of an engagement stats reset, but there’s nothing to worry about! I’ve posed this exact question to Amazon’s Developer Liaison, and this was his response (boldface emphasis mine):

You can earn more money by bringing your skills to other countries, if the skill becomes a top performing skill in both geos. Engagement stats do not reset. We monitor skills by skill ID, which does not change when you update a skill.

 

Click here to read a detailed walkthrough of the entire process of updating an existing skill to add foreign region support in How to Update Your Skills for India, from the Amazon Developer Blog.

 

Click here to read the Alexa Skills Kit documentation for the topic, Develop Skills in Multiple Languages.

 

* * *

The Belkin 3-Outlet Wall Mount Cradle Surge Protector with Dual USB Charging Ports (UK visitors – click here for Belkin’s comparable Euro version) makes the most of a single electrical outlet by providing three outlets plus 2 USB charging ports, all with built-in surge protection. Currently rated 4.5/5 stars across over 1,400 reviews and currently priced at $21.45.

Advertisements make it possible for Love My Echo to bring you great content for free, so thanks for your support.

* * *

 

Tags: , , , , , , , , , , , ,

Top