Multi-language Agents

This feature lets you support multiple root languages and locales within the same agent, allowing you to specify different User Says phrases and Responses for each language your agent supports.

In most cases, your intent structure and parameters won't change from language to language, so you'll just add additional languages to the same agent and customize the User Says examples and Responses as needed. If you do need to change the intent structure or parameters to facilitate another language, you should setup a new agent. This makes it easier to manage the differences, since newly created intents and entities are copied to all languages.

Root languages and locales

Dialogflow agents support 15 root languages, which are used for the main development of your app.

Some root languages include locale languages, which cover reigion or country specific versions of a root language. For example, French is a root language, but there are differences between how it's spoken in France and French Canadian provinces.

Ideally, you should develop primarily around a common root and only customize for specific locales if needed.

Adding a root language

Whether you’re creating an agent or already have an existing one, you can add root languages within the agent’s settings. To add a root language to an agent:

  1. Click on the gear icon next to the agent name.
  2. Click on Languages tab.
  3. Click on the Select Additional Language dropdown and choose a language from the list.
  4. Click the Save button.

Adding a locale

Additional locales (if available) can be added to encompass different versions of a root language.

To add a locale:

  1. Hover over a root language and click + Add locale. Available locales will be listed.

  2. Click on a listed locale to add it. This will show up as a separate language for your agent.

  3. Click the Save button.

Testing languages in the console

When testing in the Dialogflow test console, you can only test the selected language for the agent. For example, in the image below, English is the currently selected language. If you need to test in other languages, click on the corresponding language chip (es in the image) to switch languages.

Language chips will overflow into a "more" chip. This list is alphabetical, with the currently selected language moved to the first position.

Testing languages via API

When sending requests via the API, the language is set by the lang parameter. This should corresponnd to the listed language in this reference page.

{
  "lang": "en-GB",
  "query": "I need apples",
  "sessionId": "12345"
}

Importing and exporting a multi-language agent

When exporting a multi-language agent, the generated ZIP file contains the same folder structure as a single language agent. There is one JSON files that represents the intent and one file per language for "User Says" exmaples. For istance an intent named "weather" that uses English and Spanish would include weather.json, weather_usersays_en.json, and weather_usersays_es.json.

Exported entities will also include two files. If you have an entity called "cities", it would include cities.json and cities_entries_es.json.

Importing an agent, whether multi-language or not, now specifies one language as the default language. This is the language specified when you create the agent.

Adding an intent or entity to a multi-language agent

When you add a new intent or entity to an agent that is already supporting more than one language, the newly created intent or entity gets added to all added languages. Similar to the behavior when adding a new language, adding a new intent or entity in one language only creates a blank version in all other languages and doesn't copy any other data automatically.