When you create a new bot, you need to choose a primary language. This is the language in which you will develop the bot. In other words, this language is the one that is shown in the 'Bot dialogs' module where you will configure all the messages, button labels, content, links and logic of the bot.
The structure and logic of the bot is defined once and will then be reused for all languages. That means that you only have to build the bot once, and then simply can translate it. If you add functionalities or conversational flows, they will automatically be added to the secondary languages as well. This makes sure your bot remains in sync and offers a consistent experience in all languages.
When you have created a multi-lingual bot, you will notice that in the NLP module, you can switch the active language in the menu bar at the top, upper right. When you switch languages, the color of the interface will change.
Things to remember when managing NLP models in more than one language:
- If you add an intent, the intent will automatically be added to all other languages as well. You can add intents in the primary as well as in the secondary languages
- If you add an expression, the expression is language-dependent and will only be added to the active language model
- As language models are independent from each other, so you'll have to train and publish them separately. That means that if you make changes in two languages, you will have to train and publish both
- The number of expressions that is displayed under 'Intents' is the number of expression for the active language
A bot that speaks both English and Arabic
If you have built your bot to support multiple languages, you want it to talk to the user in their own language. A bot that doesn't have any information about the user's language will automatically use the primary language.
You can use the
Language detectionoption to check if the user's language is supported by your bot. You can find this feature under
- If the user's language is supported, the user will be routed to the
- If the language is not supported by the bot, the user will be routed to a bot dialog of your choosing
- Let's create an input validation dialog that allows the user to select their preferred language. You can name it 'Choose language'
- In the
Choose languagedialog, ask the user in what language they want to continue
- Make sure to save this input as a variable with the name
- If you use buttons that the user can click to select a language, please make sure they also contain the
preferredLanguagevariable and a two-letter language code (en, nl, fr, de, ...) for the value
Our dialog now looks like this:
Click on the image to enlarge it