- Print
- PDF
Key Benefits
This development aims to integrate multiple TTS (Text-to-Speech) and manage multilingual projects more effectively. It provides the following benefits:
- Flexibility: Ability to support different languages in a project by using various TTS languages.
- Optimized User Experience: Ensuring users receive responses in their preferred language accurately.
- Ease of Management: Facilitates dynamic adaptation to language changes within projects.
1. "locale" Parameter
In multilingual projects, it is crucial to know which language-based TTS to use for requests. This need arises to ensure that we can provide the correct language response to users from the very first utterance. By including the "locale" parameter in the request sent to the VA, we can determine the appropriate language before the conversation begins. This allows us to set the TTS language accordingly, ensuring a seamless and accurate user experience. The "locale" parameter should be added to the activity object and conveyed to the VA. Below is an example of such a request:
{
"text": "hello",
"type": "message",
"channelId": "TestChat",
"conversation": {
"id": "0123456",
},
"locale": "en-US"
"attachments": [],
"channelData": {
"ResponseType": "Text",
"CustomActionData": null,
"IsSynchronizer": false,
"HasExternalAudioContent": false,
"SrConfidence": null,
"CustomProperties": {},
"EndUser": {
"Name": null,
"Phone": null,
"Email": null,
"Twitter": null
}
}
}
The language codes received from this parameter are expected to match the project languages and also what TTS expect as language parameters.
This is crucial for TTS-enabled projects, as it determines which language code should be used for a given TTS provider. For example, the language codes supported by Sestek are:
- tr-TR (Turkish)
- en-US (English)
- ar-SA (Arabic)
- lv-LV (Latvian)
- ru-RU (Russian)
- es-ES (Spanish)
- ur-PK (Urdu)
- fr-FR (French)
- nl-NL (Dutch)
- de-DE (German)
- it-IT (Italian)
When using a different TTS, it is important to consider the supported language codes of that provider. Check the link for Microsoft supported Language codes.
2. "ResponseLanguage" Variable
The "ResponseLanguage" variable is a new static variable within the flow. This variable is populated by the "locale" parameter received in the request to the VA. If "locale" is null or not among the defined project languages, it retains its default value of "undefined."
Mainflow & Subflows:
- In the main flows and subflows, the default value of "ResponseLanguage" is "undefined."
- The value can be intentionally overridden within the flow by setting it to an appropriate project language. If it is not overridden, the value will not be set in every message.
- If a value from the project's supported languages is sent through the "locale" parameter, it will retain that value until overridden.
- If "locale" is not among the project languages, "locale" will not be set, and the existing "ResponseLanguage" variable will be retained.
- If a TTS is integrated and "ResponseLanguage" is undefined, the TTS will use the project's primary language.
ActionFlows:
- In ActionFlow, the value of "ResponseLanguage" aligns with the VA language.
- For example, if the main flow is in English but the user enters a Turkish VA, "ResponseLanguage" will be set to "tr-TR," and the TTS will use the VA's language.
3. "LanguageCondition" Node
To handle the increasing number of multilingual projects, a "LanguageCondition" node has been introduced. The outputs of this node correspond to the project's defined languages and an "other" option. This node functions as a condition node, where the condition checked is the "ResponseLanguage" value, directing the flow to the appropriate output.
Details
- The node will only appear in the palette if the project has more than one defined language and is independent of TTS.
- The node can be used in main flows and subflows but not in intent actions, FallbackSRs, or surveys.
- The outputs of the node are based on the project's defined languages and an "other" option for any unspecified languages.
How to Use
- Add the "LanguageCondition" node to the flow during design.
- The node selects the appropriate output based on the value of the "ResponseLanguage" context variable.
- For example, If the user sets "locale" to "en-US" and this value is assigned to the "ResponseLanguage" context, the "LanguageCondition" node directs the flow to the French output.