Use Multi language

9 minutes
Share the link to this page
Copied
  Completed

Transcript

Hello guys, welcome to the 33rd session of create custom Alexa skill using AWS lambda function tutorials for beginners. In this session we will learn how to create a skill containing multiple languages and use the I ating next package to generate a response based on requested language. I will convert skills that we have created in previous session into multi language skills. Click on this drop down and select language settings click on add new language select language that you want to use and selecting English India. We can also remove language if skill contains multiple languages Click on Save button click on custom Nicole Jason editor Your is interaction model for English us let us copy this. From this drop down select English India you can see that it does not contain any tense that we have created.

I will use the same model for both languages. But you can also use different sample utterances or even invocation names. Click on the big model. Here we have used kill console to create a multi language model. Now I'm going to show you how to create it using CNI. Let us switch to Visual Studio Code copy English us five and printing to be a German language.

Create one more copy for French use fr modify this if you want. Let us open schema Jason. No case contain all of the publishing data related to our schema this will be shown in skill store. That is copy this and change to D and F. Now, our skill can also install on a device having German and French as a default language. Alexa SDK version one was using I 18 next package for localization, but in version two, it was removed to make compact however, we can install it and use it manually open terminal change working directory to custom install this along with this I need to install as print f post processor input both of them now we need to create JSON object containing all messages. I have already created it so pasting it here.

Here is the language code. We must need to add all messages to translation property. Here is a key that will be used to represent this message. We can also use interpolation concerned with it thing. We need to write property name in double curly braces. For German and French I have used being translated so it may contain any wrong message text Now we need to set the default translation in 18 legs for this right I at Next use sprint F. In overload translation option handlers said from s print F. We need to return objects and the first language will be English us.

That's all messages and resources. First of all we need to set language expert request for that use change language method. Within that we need to pass local from the request. Now we need to use all messages by i 18. That is copy this light of setting up local and pay State in all handler. Let us start with launch request.

We need to write it next dot t, TN T stands for translation. In parameter you need to pass key for message that you want to use. We need to use welcome message here. updated in person name intent handler. As previously stated, We can also send dynamic rendering message. Use your name is named.

Here we need to pass an object containing values Let us update keys for all other anchors. unify and declare anti ski Open simulator and tested doctor whiskey Welcome to the Alexa skills kit you can say hello that is send a request for a person named intent. Your name is Sofia write me got the welcome message expert English because in the request you can see that local as the English us there is copy request Jason click on manual Jason. paste it here and change local to the info German Sandy Yeah we got a response in the German language. Let us try for French it is working as per our expectations. Let us see what we have learned in this session.

To add a new language or remove existing we need to open language settings from in console. We can also create these via skill dot Jason we need to provide interaction modal for both of them and it can be different as for language. To generate a response based on the language we need to insert ating next package and create an object that will contain all of the messages means done languages. To add dynamic string we need to enclose it in double curly braces then Use in each method to register our messages in this we need to update language with local records in the request. to reclaim message we need to use t matters and pass the key. If it contains any other string, then pass an object for that.

Thanks for watching this video. If you have any doubts, please feel free to contact me when I say

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.