Switching language using intent trigger
Last updated
Was this helpful?
Last updated
Was this helpful?
The most common way to have users choose their language of choice is using the ask: language node when the language selected by the platform isn't correct.
Another way of offering users to change their preferred language is by building an intent trigger in your flow that then triggers the switch language node to switch to the right language.
In this example we are going to offer a way to switch to the dutch language, but using this example you can implement any language switch.
Go the the AI section and open the Intents page. Add an intent called "Switch to dutch".
Go to the Flows section and open the Playbook. Now right click on your canvas and choose to add an Intent trigger to the flow:
Now pick the intent you just created in the side panel of the newly created intent trigger by clicking on the pick button and select the intent switch_to_dutch.
Now drag a line from the newly created intent trigger node and pick the Switch language node in the Flow control menu.
Now configure it to switch the the dutch language by picking the language in the drop down. When the language isn't available, you might need to add it in your bot settings first. Go to the bot identity page for this in settings.
Now when the language is changed while a conversation is in the middle of an Ask node or Iterate node, the App will still repeat the text in the previous language. This is because the ask and iterate texts are already loaded in memory. The only way to solve this is by restarting the conversation. This can be done by dragging a line from the newly created switch language node and add the node Flow control: Restart.
Now the conversation will restart in dutch after having switched to dutch by the global intent.