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.

Language-specific data

Most agent data is common for all languages of a multilingual agent. However, text used to interact with an end-user is language-specific. When building a multilingual agent, you must supply this language-specific data for each language. When you select a language from the console or provide a language to the API, you can access this language-specific 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 type 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.

Entity screenshot

To access language-specific data with the API, provide the languageCode 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 queryInput.input.languageCode field of the detectIntent method. For more information, see the Sessions type.

Requests that do not supply an agent's 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 automatically determines the input language and responds in that language if automatic language detection is enabled. If automatic language detection is disabled, 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.