Localizing a bot for different languages, markets, and/or cultures is a common use case. This is accomplished in Teneo through branching, where we have the option of creating a 'Master' version of a solution and its own 'Local' versions for each of the different languages we are interested in. In this way, Teneo allows us to create local solutions with all of the parts of the master solution that we want to include, making it an efficient way to create bots for different languages and markets. You can read more about localization here.
A webinar on Localization can be found here.
In this guide, we will demonstrate how it is possible to localize the 'Longberry Baristas' solution, which is in English, to another language with resources, Swedish. More on branching can be found in the Documentation.
Note that branching is also supported for languages without resources.
We will start by preparing the solution we want to localize. In this case, it is the 'Longberry Baristas' solution that's included in the free trial account you can create at Teneo Developers.
It is time to include the relevant content from Longberry Baristas for branching.
We will start off with two of the bots' key flows.
A more detailed explanation of these steps can be found here.
We selected these two flows as they offer the key functionality that we want to offer in Longberry Baristas. In a real use case we would also want to include a 'User wants to know if we have a store in city', as this is also an integral part of what a user would expect Longberry Baristas to be able to answer.
These flows use class match requirements, which also means that they depend on Classes. These are stored in the Class Manager.
Entities are also used in these flows, and also need to be included for branching.
The 'User wants to order a coffee' flow also makes use of a global variable that needs to be included for branching.
At this point, we would also need to go over any other content we may need to include, such as Integrations, Contexts, Global Scripts and Listeners. However, for the two key flows we have selected in Longberry Baristas, no other content is used. Therefore, we can go ahead and start localizing!
Don't worry! It is possible to update your 'Master' solution if you forgot to include something before branching. Simply go back to the 'Master' Longberry Baristas solution, and include it. Then return to your 'Local' solution, go to the Solution backstage, and click on the 'My Work' section. We can now see the changes from the 'Master' solution, where we can either select Update All items to update everything or Update Selected items to only update relevant parts. Once updated, the local solution will pull in the changes from the Master solution.
Now that we have prepared our solution, let’s branch our English Longberry Baristas bot to a different language. This process is fairly similar regardless of language; we will be using Swedish for this example.
While this guide is written with a Swedish translation, feel free to pick another language and translate as necessary for the following steps.
Swedish Longberry Baristas
.For languages without resources leave the Just master content selected under 'Solution Content'.
Teneo comes with pre-built Lexical Resources for a couple of languages. These resources help your bot to understand a specific language's words, synonyms, and expressions. This step should be skipped if the selected language does not have any resources.
Let's specify which Teneo Lexical Resources to use for your bot. This is what you need to do:
Warnings in Try Out appear as yellow warning triangles. To see more detailed warning messages, open the Try Out window and navigate to the Messages section. More information on warnings can be found here.
The most important aspect when localizing bots is for the final language to actually make sense for the target audience. Both in respect to the language that they actually use and the language that fits the market and culture. Flow triggers with Class-based match requirements are usually the easiest to localize. They usually use a limited number of Language Objects, where the only parts that need any localization are the training examples. To localize a Class-based match requirement trigger, do the following:
Vad har ni för utbud?
.Vad har ni för utbud?
Har ni bryggkaffe
Har ni cappuccino
Serverar ni macchiato
Vilka kaffesorter har ni tillgängliga?
Vilka typer av kaffe har ni
Vilken kaffesort serverar ni
Har ni latte?
Vilka olika kaffedrinkar har ni
Vad säljer ni?
Vad har Longberry Baristas för utbud?
Vad för kaffeutbud har ni?
BESKRIV_KAFFEUTBUD
.Now that we are done with the class, next up we have the transition and the outputs to be localized.
Kaffedryck nämns och serveras
Vi serverar kaffedrycken!
. While at it, replace the output answer with Ja, ${mentionedCoffee} finns med bland vårt utbud!
Vi erbjuder en mängd olika handgjorda kaffesorter...
.Vi erbjuder en mängd olika handgjorda kaffesorter från espresso till macchiatos, flat whites och ännu fler.
.Congratulations, you have now localized part of your solution! Let us move on to the next flow.
Some flows will have multiple triggers with multiple match requirements. Localizing these is simply a matter of going trigger by trigger and match requirement by match requirement. Let us start by going through the triggers one by one.
Jag vill beställa kaffe
.En vanlig kaffe, tack!
Jag vill beställa kaffe!
Har ni Espresso?
Skulle jag kunna få en macchiato?
Jag vill ha en flat white.
En latte tack!
Jag vill ha en latte tack!
Har ni vanligt bryggkaffe?
En bryggkaffe
BESTÄLL_KAFFE
.Next in line is the Entity Match Requirement for 'PERSON.ENTITY', which uses a Named Entity Recognizer tagger to recognize personal names . As the Swedish Teneo Lexical Resources includes a 'PERSON.ENTITY' already, there is nothing here to update. For languages without any Lexical Resources we recommend creating their own Language Objects for storing different names and using Data Actions on Language Objects to retrieve the name. If that is not an option, remove this 'Data Action' and use the store the users name condition in the transition 'Get user name'.
En till tack
.1 till
En till
En till beställning
får jag beställa en till
Jag vill lägga en till beställning
Kan jag få en till kopp
EN_TILL_TACK
.Kan jag få en sån
Kan jag få en sån?
Då tar jag en sån
Kan jag få en sån, tack!
In the same trigger, the Global Variable Context match requirement will continue to work, but the Condition match requirement will need some updating. As you’ve already translated the examples, you can let Teneo generate a condition for you as done here.
Next in line is the localizing of the three transitions with conditions found inside the flow.
This transition has a condition for 'COFFEES_SERVED.ENTITY' which needs to be localized by doing the following,
Användaren svarar med kaffesort
.Coffee name | coffeeType |
---|---|
americano | americano |
%CAPPUCCINO.NN.LEX | cappuccino |
cortado | cortado |
%ESPRESSO.NN.LEX | espresso |
frappuccino | frappuccino |
latte | latte |
lungo | lungo |
macchiato | macchiato |
ristretto | ristretto |
flat white | flat white |
kokkaffe | kokkaffe |
bryggkaffe | bryggkaffe |
brygg kaffe | bryggkaffe |
bryggd kaffe | bryggkaffe |
bryggkaffen | bryggkaffe |
Lastly, we have the final transition, which includes 'PERSON.NER' as a condition.
Användaren svarar med namn
.If you have not created a Language Object. Please follow these steps to store the users input.
Next up we need to localize the four outputs found inside the flow.
Fråga om kaffesort
.Ok, vilket kaffe vill du beställa?
.Vi fortsätter med din beställning. Vilket kaffe vill du ha?
.Fråga om namn
.Ok, vilket namn ska jag skriva ner för beställningen?
.Last in line is the final output node where the user's order is summarized.
Sammanfatta order
.Tack för din beställning, ${userNameForOrder}. En ${orderedCoffeeSize} ${orderedCoffeeType} är redo att hämtas om fem minuter.
.You are now done with the key flows in your first localization of the whole solution. Let us test it in Try Out!
Vad för kaffeutbud har ni?
Jag vill ha en bryggkaffe
Go ahead and include more flows to localize from the original 'Longberry Baristas'. Use your local language when following the steps above.
Was this page helpful?