> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/understanding-users/multilanguage-bots.md).

# Multilingual bots

Chatlayer supports many languages. From Dutch to English, Hindi and Afrikaans – find the complete list [here](/~/changes/zWOY8fNiBBrqneKkuGvA/understanding-users/natural-language-processing-nlp/supported-languages.md).

## 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](/~/changes/zWOY8fNiBBrqneKkuGvA/understanding-users/multilanguage-bots/translations.md) tool.&#x20;

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

![A bot that speaks both English and Arabic](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MkI7ah3EVY-qndPuJl_%2F-MkI7j5nSnIIys9qMjUv%2Fimage.png?alt=media\&token=9b98196d-b2b3-4a13-83e2-53180093226a)

## 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.

{% hint style="info" %}
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.
{% endhint %}

#### 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` dialog
* If the language is not supported by the bot, the user will be routed to a bot dialog of your choosing

![](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MkI4YhB9HpEEsdKrjuV%2F-MkI4xqMDS_ObrVKgcA1%2Fimage.png?alt=media\&token=f2321366-b3fc-4de6-8445-41cc245364d9)

{% hint style="warning" %}
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`.
{% endhint %}

* 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 language` dialog, ask the user in what language they want to continue
* Make sure to save this input as a variable with the name `preferredLanguage`&#x20;
* 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 dialog now looks like this:

![Click on the image to enlarge it](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MkI4YhB9HpEEsdKrjuV%2F-MkI4ghLtYfcz4NmLFUT%2Fimage.png?alt=media\&token=5cb66ea7-5bf2-4b9f-ae0e-aa233e883ace)

#### 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](/~/changes/zWOY8fNiBBrqneKkuGvA/channels/webwidget.md#default-locale).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/understanding-users/multilanguage-bots.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
