Multilingual agents

Dialogflow supports many languages. For the complete list, see the languages reference page. The language you choose when creating an agent is set as the default language, and you can add additional languages.

Root and locale-specific languages

There are two categories of languages:

  • Root languages: These are languages like English (en) that do not specify a locale.
  • Locale-specific languages: These are languages like English-US (en-US) that do specify a locale as a specific region or country.

Some languages act as both root and locale-specific. There are significant differences between locales for these languages, so the locales cannot share a common root language. Examples:

  • Chinese-Cantonese (zh-HK)
  • Chinese-Simplified (zh-CN)
  • Chinese-Traditional (zh-TW)
  • Portuguese-Brazil (pt-BR)
  • Portuguese-Portugal (pt)

You should primarily design your agent for root languages, and only customize for locale-specific languages as needed.

Add a language

To add a language or locale with the Dialogflow Console:

  1. In the left sidebar menu, click the add language button next to the existing language(s).
    This takes you to the Languages tab of agent settings.
  2. Choose a language from the Select Additional Language dropdown menu.
  3. To add a locale, hover over a root language and click + Add locale.
  4. Click Save.

Multilingual intent and entity data

For intent and entity data, some data is common for all languages of a multilingual agent, and some data is language-specific.

Language-generic intent and entity data

Language-generic intent and entity data is common for all languages supported by an agent. Even though a specific language may be selected in the console or provided to the API, this data is shared for all languages. For example, the following data is language-generic:

Language-specific intent and entity data

Language-specific intent and entity data is unique for each language supported by an agent. You must supply this data separately for each language. When you select a language from the console or provide a language to the API, you can access this data for the given language. The following is a complete list of language-specific data:

To access language-specific data with the console, click the language button under the agent name.

For example, the size entity below is used for ordering t-shirts. The agent was originally configured in English, so the entity has entries like "S" with the synonym "small". When Spanish is added as a language, the entity is created by Dialogflow for the new language, but you need to supply entity entries in Spanish.

To access language-specific data with the API, provide the language_code parameter when getting, creating, or updating EntityType or Intent types. You must make separate API calls for each language to access all language-specific data. If your API calls update language-generic data, that data is updated for all languages.

Test in the simulator

When using the simulator, choose the language you want to use by selecting it below the agent name.

Supply a language using the API

When sending requests via the API, set the languageCode field. For more information, see the detectIntent method for the Sessions resource.

Requests that do not supply a supported language

When Dialogflow receives a request that does not supply a language supported by the agent, the following rules apply:

  • When a request does not supply a language, Dialogflow handles the request using the default language.
  • When a request supplies a locale-specific language that is not supported by the agent, but the associated root language is supported by the agent, Dialogflow handles the request using the root language.
  • System entity extraction is an exception to the previous rule. System entity extraction uses the supplied locale-specific language, even if the locale-specific language is not supported by the agent.

Integrations

Agent interactions through text-based and phone gateway integrations only use the default language of the agent.