Make your agent multilingual

Dialogflow supports many root languages that can be used for the main development of your agent. Some root languages include locales, which cover region or country-specific versions of a root language. For example, "French" is a root language that includes France and French Canadian locales.

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

Add a language

The language you choose when creating an agent is set as the default language. After developing your agent, you can add additional languages and locales to expand usability to other regions or countries.

To add a language or locale, follow these steps:

  1. In the left menu, click on the plus add icon next to the existing language(s).

    This takes you to Settings>Languages.

  2. Choose a language from the Select Additional Language dropdown menu.

  3. To add a locale, hover over a chosen root language and click + Add locale.

  4. Click SAVE .

When you add new languages, all intents and entities are copied over, but do not include training phrases, responses, or entity entries.

For example, the example agent pictured below has a "size" entity for ordering t-shirts. The agent was originally configured in English, so the "size" entity has entries like "S" with the synonym "small". When Spanish is added as a language, the "size" entity is included in the agent, but entries in Spanish need to be added.

To add entities to another language:

  1. Click on the language button under the agent name.
  2. Click on Entities in the left menu.
  3. Click on the entity you want to add entries to.
  4. Add the necessary entries and synonyms.
  5. Click SAVE.

Test in the simulator

Once all the training phrases, responses, and entities have been updated with the new language, you can test it out in the simulator. When using the simulator, make sure to click on the button specifying the language you want to use below the agent name.

Test with the API

When sending requests via the API, the language is set by the lang field in V1 and is automatically detected and provided in QueryResult in the languageCode field in V2.

V2 API

{
    "queryText": "Necesito camisetas",
    "languageCode": "es",
    ...
}

V1 API

{
    "lang": "es",
    "query": "Necesito camisetas",
    "sessionId": "12345"
}