Multilingual bots

Chatlayer supports many languages. From Dutch to English, Hindi and Afrikaans – find the complete list here.

Primary language vs. secondary languages

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.

When creating a new bot, you can also choose (multiple) secondary languages. To configure the copy for these languages, you can use the Translations tool.

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.

Managing a multi-lingual NLP

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

Talking to the user in the right language

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.

Language detection can't be applied to text, so a chatbot cannot figure out what language the user is speaking based on what they're saying to the bot. Instead, it will use channel information. On Facebook, for example, the bot will use the value it receives from the FB user API. For the web widget, it'll use the SDK language.

Language detection flow

You can use the Language detection option to check if the user's language is supported by your bot. You can find this feature under Bot Settings.

  • If the user's language is supported, the user will be routed to the Introduction block

  • If the language is not supported by the bot, the user will be routed to a block of your choosing

Whenever the user types an expression in a language other than the preferredLanguage activated, the bot will not automatically switch to that language. If the expression is in a language that the bot knows, the expression will be processed and the bot will answer in the original preferredLanguage.

  • Let's create an Collect info block that allows the user to select their preferred language. You can name it 'Choose language'

  • In the Choose language block, ask the user in what language they want to continue

  • Make sure to save this input as a variable with the name preferredLanguage

  • If you use buttons that the user can click to select a language, please make sure they also contain the preferredLanguage variable and a two-letter language code (en, nl, fr, de, ...) for the value

Our block now looks like this:

Web widget

In the web widget you can trigger a specific bot language based on the language of the page the user is looking at. Learn more here.

Last updated