Languages

Dialogflow has multi-language support for several languages and your Chatfuel bot can tell Dialogflow which language to use so you can deliver language-specific responses to your users. Even if Dialogflow doesn't support your language, you can still use your Janis integration to support an unsupported Dialogflow language. (See second half of tutorial).


When you first create a Dialogflow agent you'll want to set your default language. You can only set your default langage when you first create your agent and then add other languages after. Dialogflow will use English as your default language, unless you explicitly select a default language.

Dialogflow languages for Chatfuel

To add another language, click the ⚙ next to your agent name in Dialogflow and jump over to the language tab.

Dialogflow languages for Chatfuel

If you click the language code, that will be activate the language you are training in. Toggle between languages to create intents in different languages.

Dialogflow languages for Chatfuel

A best practice is to include a language selection in your Welcome message and each selection links to a block based on their selection.

Dialogflow languages for Chatfuel

In an block for your English language, you can include a User Attribute called {{lang}} and set the value to en (The Dialogflow language code for English). When you add languages to Dialogflow you can see that each language includes a language code, so these would be values that you pass to Janis and the code will tell which language Dialogflow should respond with.

Dialogflow languages for Chatfuel

Clone your English block, only here set the value for the {{lang}} User Attribute to a different language code (In this example, we've set Dialogflow’s language code for Italian).

Dialogflow languages for Chatfuel

A best practice for a multi-language Chatfiel bot is to enable your users to send messages that let them switch languages in the middle of a conversation. Create two Intents. Using the example here, in the English version of the Intent you would include "Spanish", and "Español" as training phrases and in the Spanish version of the Intent include English as a training phrase. Dialogflow might automatically highlight the language you enter as a training phrase, recognizing it as an Entity, but click the Entity in your phrase and select the trash can to remove the highlight on the word, or phrase you add. Toggle between your languages in Dialogflow to include a phrase that references the other language and redirect to the corresponding language-specific block for your repsonse in Chatfuel.

Dialogflow languages for Chatfuel

When you have multiple languages in your Dialogflow agent, one set of Intents are shared between languages. The Intent name will the same for every language you add, but you can modify the elements within an Intent by toggling between the languages in Dialogflow. You'll want to translate training phrases, and set different responses for each langauge version of the Intent. You can also have different Entities for each language version of the Intent. You could toggle between languages, and then use Dialogflow's built-in System Entities, or create your own language-specific Entities.