Languages and Skills
You can design both single-language and multi-language skills. For understanding user input, you can either use Oracle Digital Assistant's native support for various languages or a translation service. For output, you typically define the strings for each target language in resource bundles.
Language Use Cases for Skills
The approach you take to handling your language requirements for skills depends on a number of factors. Here are some typical use cases and ways you can approach them.
Ability to Train in Multiple Languages
For skills that you target to the languages that Oracle Digital Assistant supports natively, you can add training data for all of the target languages. This includes example utterances for intents and custom entity values.
Prerequisites:
- The languages you are targeting all are on the list of Natively-Supported Languages.
- The Platform Version of the skill is 20.12 or higher.
General steps:
- When creating the version (or clone) of the skill, designate one of the natively-supported languages as the primary language. This language will serve as the default language in the skill. Once you have set it, you can not change it.
- On the skill's Settings, Intents, or Entities page, add any additional natively-supported languages that you want to target.
- Build the training corpus in the primary language.
- For each additional language, augment the training corpus as necessary.
- For any value list entities that you create in the primary language, add values in the additional language that correspond to each of the values in the primary language.
- Create resource bundles for each of the skill's output strings, provide entries for each language, and reference the resource bundle keys from the appropriate places in the dialog flow and the skill's settings.
Other notes and considerations:
- In terms of user experience, this approach gives you the best opportunity to satisfy user expectations in multiple languages.
- To realize the potential of this approach, be sure to allocate adequate resources for multi-language intent training and formulating effective output messages in all of the target languages.
Avoid Using a 3rd-Party Translation Service
If you want to create a skill with one or more non-English languages but don't want to use a 3rd-party translation service, you can use Digital Assistant's native language support. See the above Ability to Train in Multiple Languages topic.
Create a Skill in a Language Not Supported Natively
Typically, if the language you are targeting for a skill is supported natively in Oracle Digital Assistant, you would use that native language support for the skill. However, if that language is not supported natively, you can use a translation service.
Prerequisite:
- You have configured a translation service (either Microsoft Translator or the Google Translation API).
General steps:
- When creating the skill, designate the target language as the primary language (and in translation mode).
- Create intent utterances and entity values in the language that you are supporting.
- Add code to the dialog flow to detect the language of the user input and to translate it behind the scenes. (For non-English skills that rely on a translation service, the underlying training model of the skill is in English.)
- Create resource bundles for the skill responses.
Other notes and considerations:
- If the target language of your skill is among the natively-supported languages, consider using the native language approach. Then, if you later need to add other languages that are natively supported, you will be able to optimize intent resolution for each language (in addition to having more control over the output messages).
- If you later want to add other languages to the skill and one or more of the desired languages isn't supported natively, you would need to create a new skill from scratch and set English as the primary language in the new skill.
- Entity values for built-in entity types (such as NUMBER, EMAIL, and DATE) are extracted after the user input has been translated to English behind the scenes.
Create a Multi-Language Skill that Targets Languages That Are Not Supported Natively
If you are designing a skill that targets multiple languages and one or more those languages are not supported natively, you can use a translation service for the skill.
It's currently not possible to have a skill that mixes native language support and a translation service. If any of the languages are not supported natively, you have to use the translation service for all of the languages.
Prerequisite:
- You have configured a translation service (either Microsoft Translator or the Google Translation API).
General steps:
- When creating the skill, designate English as the primary language (and in translation mode).
- Create intent utterances and entity values in English.
- Add code to the dialog flow to detect the language of the user input and to translate it behind the scenes.
- To handle skill responses, either:
- Set up the dialog flow to translate skill responses from English to the user's language.
- Create resource bundles with entries for each target language and configure the skill to use them in its responses.
Other notes and considerations:
- Entity values for built-in entity types (such as NUMBER, EMAIL, and DATE) are extracted after the user input has been translated to English behind the scenes.
Create a Multi-Language Skill Without Resource Bundles for Each Language
If you'd like to create a multi-language skill but do not want to create resource bundle entries for the various languages, you can use the translation service to handle the skill's responses. (This approach does not work with Digital Assistant's native language support.)
Prerequisite:
- You have configured a translation service (either Microsoft Translator or the Google Translation API).
General steps:
- When creating the skill, designate English as the primary language (and in translation mode).
- Add code to the dialog flow to detect the language of the user input and to translate it behind the scenes.
- Set up the dialog flow to translate skill responses to the user's language.
Other notes and considerations:
- If all of the target languages of your skill are all among the natively-supported languages, consider using the native language approach instead, since this will enable you to optimize intent resolution for each language (in addition to having more control over the output messages).
- Even if you need to target languages that are not natively supported, you may find that the benefits of having greater control of the output messages justifies the costs.
Language Mode
When you create a new skill (or version or clone of a skill), you use the Primary Language field in the Create dialog to determine both:
- A primary language.
- A language mode (either Natively Supported or Translation Service).
The language mode determines:
- How the user language is detected and processed.
- Which languages you can add to your skill.
- If your skill uses the Natively Supported language mode, you can use any of the languages that are supported natively in Oracle Digital Assistant.
- If it uses the Translation Service mode, you can use any of the languages supported by the translation service.
Caution:
Once you have clicked Create in the wizard, the language mode is permanently set for that version of the skill. You can't mix and match language mode in skills or digital assistants.Native Language Support for Skills
Starting with Platform Version 20.12, there is native support in Oracle Digital Assistant for some languages. When you develop a skill with this native language support, you don't need to use a 3rd-party translation service to handle user input and skill responses in those languages.
If you are developing such skills for inclusion in a digital assistant, that digital assistant must also use the native language support. See Native Language Support in Digital Assistants.
How Native Language Support Works
-
Training data can be supplied in each of the (natively-supported) languages that you are designing the skill for.
When you use native language support, the skill is trained according to a unified model that incorporates all of the natively-supported languages. You can provide training utterances in one or more of your skill's target languages. The training utterances that you provide in one language help build the model for all of the skill's languages. For skills that you target to multiple languges, typically you will start by building your training corpus in the skill's primary language. Then you can (and should) add training utterances in the other languages, though you probably won't need nearly as many in those other languages.
This differs from skills that use a translation service. In those skills, the underlying training model is always in English, even if the training corpus is provided in another language.
- Entity values for built-in entity types (such as NUMBER, EMAIL, and DATE) are extracted in the language of the conversation. (This differs from the case with skills in translation service mode, where the values are extracted after the input has been translated by the translation service.
- Entity values for custom entities are matched to the values provided for the language of the current conversation.
- Skills that support non-English languages must be trained with Trainer TM.
Natively-Supported Languages
Here are the languages (and the corresponding languages codes) that are currently supported natively in Oracle Digital Assistant.
- Arabic (ar)
- Dutch (nl)
- English (en)
- French (fr)
- German (de)
- Italian (it)
- Portuguese (pt)
- Spanish (es)
This means that you can create skills and digital assistants for these languages without using a translation service, such as Google Translate.
Here's an overview of the level of support for each language.
Language | Language Understanding | Voice | Insights | Data Manufacturing | Conversation Designer |
---|---|---|---|---|---|
Arabic (ar) | Yes | No | Yes | Yes | No |
Dutch (nl) | Yes | No | Yes | Yes | No |
English (en) | Yes | Yes, including the en-US, en-GB, and en-AU locales) | Yes | Yes | Yes |
French (fr) | Yes | Yes | Yes | Yes | No |
German (de) | Yes | Yes | Yes | Yes | No |
Italian (it) | Yes | Yes | Yes | Yes | No |
Portuguese (pt) | Yes | Yes | Yes | Yes | No |
Spanish (es) | Yes | Yes | Yes | Yes | No |
For a more detailed comparison of the support for each language, see Feature Support by Language.
Create a Skill with Natively-Supported Languages
Here are the general steps for creating a skill that uses Oracle Digital Assistant's native language support.
- When creating the skill, select Platform Version 20.12 or higher and select the primary language that you want to support from the Primary Language dropdown.
The language you select must be within the Natively-Supported section of the dropdown.
- For each intent that you create, add utterances for your skill in the primary language:
- Click
to open the side menu, select Development > Skills, and open your skill.
- In the left navigation for the skill, click
- Select an intent.
- In the Examples text field, type the utterance and press Enter.
- Repeat the previous two sub-steps for each intent.
- Click
-
For any custom entities in your skill, make sure the values are in the skill's primary language.
You can add and edit custom entities by clicking
in the left navigation of the skill.
- For any components in your dialog flow that have properties that display prompts or labels, make sure that you explicitly define those properties. If you don't define these properties, customers may encounter default text from those properties, which are in English.
- In the skill's settings, update all of the configuration messages and prompts to use the primary language:
To access these messages and prompts:
- In the left navigation for the skill, click
.
The messages and prompts are located on the Configuration and Digital Assistant tabs.
- In the left navigation for the skill, click
If you're planning to support multiple languages in the skill, you will need to define resource bundle keys for the properties, prompts, and messages that may be displayed to users. And, even if you don't plan to support multiple languages, you may want to do this anyway, since the resource bundle provides a single place where you can edit the values of all of your strings. See Resource Bundles for Skills.
Add Natively-Supported Languages to a Skill
For skills (or versions of skills) where you have chosen a natively-supported primary language, you can add additional natively-supported languages.
- Make sure your skill is running on Platform Version 20.12 or higher.
If it isn't, you need to create a clone or a new version of the skill and set it to use Platform Version 20.12 or higher.
- In the skill's left navbar, click the Settings(
) icon and select the General tab.
- Scroll down to the languages section, click Add Language and select the language from the dropdown.
- For each of the intents in the skill, add a conversation name and additional utterances in the added language:
- Click Intents (
) in the left navbar.
- Select the intent to edit.
- Select the tab for the language that you just added.
- Click
to enter a descriptive name or phrase for the intent in the Conversation Name field.
- Click Intents (
- For any entities that are based on key-value pairs (value list entities and dynamic entities), enter values for that language.
- Enable the skill to display entity values in the language of the conversation:
- In components that you use to resolve entities (Resolve Entity and Common Response), make sure that the
useFullEntityMatches
property is set totrue
.By doing this, you ensure that custom entity values are stored as JSON objects instead of as simple strings.
- In all of your FreeMarker expressions that reference custom entity values (whether in the dialog flow or in various skill properties), insert the attribute corresponding to the value you want to read. You can use any of the following attributes:
value
- returns the value of the entity in the conversation of the language.primaryLanguageValue
- returns the value of the entity in the primary language of the skill. You would use this option for expressions that are used for business logic (e.g. to determine whether or not to display a prompt, based on the entity value).originalString
- returns the value that the user entered to match the entity. This value could be a synonym of the entity value.
For example, if you have the expression
${PizzaSize}
for referencing the value of the PizzaSize entity, you would change it to${PizzaSize.value}
to display the value in the language of the conversation.
- In components that you use to resolve entities (Resolve Entity and Common Response), make sure that the
- If you haven't already done so, create resource bundle keys for all of the output that users will see, enter values for the primary language, and insert references to those keys in the appropriate places. This includes:
- Output text in the dialog flow.
- Prompts for entities that are included in the entity definitions.
- Messages and prompts defined in the skill's settings. To access them:
- In the left navigation for the skill, click
.
The messages and prompts are located on the Configuration and Digital Assistant tabs.
- In the left navigation for the skill, click
- For any components in your dialog flow that have properties that display prompts or labels, make sure that you have explicitly defined those properties (so that they don't default to English values) and create resource bundle entries for them.
- Add values in the additional language for all of the resource bundle keys.
- Augment the training corpus as necessary in the additional language.
Since skills with natively-supported languages are based on a unified training model in which all of the training helps with intent resolution in all of the skill's target languages, the training model should already work for your additional language, even without adding utterances in that language. But its accuracy will be probably be lower than it is for the primary language. To improve the accuracy, do the following:
- Build batch tests in the additional language and run them to determine how well the model performs without any utterances in the additional language. See Create Test Runs.
- Iteratively add training utterances in that language and test until you get a satisfactory level of intent resolution.
- Click Intents (
) in the left navbar.
- Select the intent to edit.
- Select the tab for the language that you just added.
- In the Examples section, enter example utterances in the additional language.
You probably won't need to add as many utterances in those additional target languages as you did in the primary language.
- Click Intents (
See the Design Camp video on Multilingual NLU to learn about best practices when making your skills multilingual.
Switch from a Translation Service to Native Language Support
If you want to take advantage of Oracle Digital Assistant native language support in a skill that has been configured to use a translation service, you can create a new version or clone of that skill and enable that support.
Prerequisite:
- The skill that you are converting must only use languages that are supported natively in the version of the platform that you are converting to. For that list, see Natively-Supported Languages.
If that prerequisite isn't met, you'll need to continue using a translation service for all of the non-English languages in the skill.
To convert a skill to use Digital Assistant's native language support:
- Create the new version or clone, and specify the primary language for the skill.
-
Click
to open the side menu and select Development > Skills.
-
In the tile for the skill that you want to version or clone, click
and select Version or Clone.
- In the Platform Version field, select version 20.12 or later.
If it wasn't present before, a Primary Language field will appear.
- In the Primary Language dropdown, select the language from the Natively Supported section of the dropdown that best corresponds to the predominant language of the previous version of the skill.
Note
The platform version and primary language can't be changed after you click Create. - Click Create.
-
- Add any additional languages that you want to support.
- Adjust your dialog flow to stop using the following mechanisms related to sending text to a translation service:
- Any translation components ( Detect Language, Translate Input, and Translate Output.
- (For YAML-based flows) the
autotranslate
context variable. - (For YAML-based flows) the component-level
translate
property.
Training Corpus for an Additional Language
When you add a language, here's how the various parts of the skill are handled:
-
Intents—The intent names, whatever their language, remain the same for each language. For each intent, you can add example utterances in each language. Since the model for natively-supported skills is unified, any utterances that you add for a given language can also help the model for other languages. Nevertheless, you can strengthen your model by adding utterances for each language.
In particular, you should concentrate on adding phrases that express an intent in a languages that are not direct translations of the phrase in the primary language.
-
Entities—For entities that are based on key-value pairs (value list entities and dynamic entities), you define the values in the primary language and then, for each additional language, add values that correspond to the primary language's values.
For prompts and messages that are defined in the entities (including prompts that are defined in composite bag entities), you reference resource bundle keys, where you provide the appropriate text in each target language.
For other properties, such as Enumeration Range Size, the values apply for all languages.
Note
The Fuzzy Match property is disabled for skills where it is not supported for all of the languages.
Language Detection in Skills with Natively-Supported Languages
In skills that use multiple natively-supported languages, the digital assistant (or standalone skill) can automatically detect the user's language at the beginning of the session. Here's how it works:
- The language is automatically detected for digital assistants and skills that are configured with multiple natively-supported languages.
- If there is only one (natively-supported) language in the skill or digital assistant, language detection is turned off.
- If the digital assistant or skill uses a translation service, the translation service handles the language detection, not the skill or digital assistant.
- The language is not automatically detected if the skill or digital assistant is accessed through a channel where the profile.languageTag or profile.locale variable has been set.
- The language is detected in the first utterance of the conversation and not updated in the session, even if the user switches languages.
- By default, the channel session last 7 days before it expires.
Translation Services in Skills
For skills that target languages other than English and which don't use Digital Assistant's native language support, you need to configure a translation service.
For such skills, when a user enters a non-English request or response, the skill uses the translation service to convert this input to English. Once it’s translated, the Natural Language Processing (NLP) engine can resolve it to an intent and match the entities. The skill can then respond to the user by using the translation service to translate the labels and prompts or by referencing language-specific strings in resource bundles.
For skills that have a training corpus in a non-English language, the translation service is also used at design time. When you train such a non-English skill, it creates English versions of the example utterances and custom entity values to be used in the training model (though these translations are not shown in the skill designer).
If you intend to add a skill that is based on a translation service to a digital assistant, that digital assistant must also use a translation service.
Translation Services Supported
OCI Language
Oracle Cloud Infrastructure (OCI) provides its own translation service called Language. If you use this service as your translation service in Oracle Digital Assistant, user messages are not exposed to a third-party translation service.
To use OCI Language as a translation service, you need to subscribe to the service and create permissions for Digital Assistant to access it. See Policies for OCI Language.
Google Translation API
To use the Google Translation API, you need to generate the API Key. You create this key from the GCP Console (APIs & services > Credentials). To find out more, see the Google Cloud Platform Documentation.
Microsoft Translator
If you want to use Microsoft Translator as your translation service in Oracle Digital Assistant, you need to subscribe to Translator or the Cognitive Services multi-service and get a secret key. See https://docs.microsoft.com/en-gb/azure/cognitive-services/translator/reference/v3-0-reference.
These are the main things you need to know:
- You need to use the Global region and its corresponding URL (
https://api.cognitive.microsofttranslator.com/
). - You need to obtain a secret key for authentication. You can get it from the Keys and Endpoints section of the Azure Portal.
Register a Translation Service in Oracle Digital Assistant
-
Click
to open the side menu and select Settings > Translation Service.
-
Click + Service.
-
In the Translation Services dialog, enter the URL and authorization key (for the Microsoft Translator service) or authorization token (for the Google Translation API) .
- URL
- Authorization key (for the Microsoft Translator service) or authorization token (for the Google Translation API) .
Add a Translation Service to Your Skill
- If you haven't done so already, register a translation service in Oracle Digital Assistant.
- Click
to open the side menu, select Development > Skills, and select your skill.
- In the skill's left navbar, click the Settings(
) icon and select the General tab.
- Navigate to the Translation Service dropdown and select your translation service.
Approaches Based on Translation Services
When you use a translation service to support skills that converse in non-English languages, you can use one of these development approaches:
-
Create non-English single-language skills where you:
- Prepare the training corpus in the target language of the skill.
When you develop non-English single-language digital assistants, you populate them with such single-language skills (where all of the skills in a given digital assistant have the same predominant language).
-
Create multi-language skills where you:
- Prepare the training corpus in English.
- Configure the skill's dialog flow to manage the translation of the user input and the skill's responses.
- Optionally (but preferably), create resource bundles for one or more languages for the skill's labels, prompts, and messages. This is desirable because it allows you to control the wording of the skill's responses.
In both cases, Digital Assistant uses the translation service to translate user input to the base language. For responses, it uses resource bundles (if provided in the skill) or the translation service to translate the skill's response back to the user's language.
Non-English Single-Language Skill Using a Translation Service
To develop a skill for a single non-English language that relies on a translation service, you:
-
If you haven't already done so, add a translation service to your skill.
- Create the utterances for your skill in the target language of the skill (instead of in English):
- Click
to open the side menu, select Development > Skills, and open your skill.
- In the left navigation for the skill, click
- Select an intent.
- In the Examples text field, type the utterance and press Enter.
- Repeat the previous two sub-steps for each intent.
- Click
-
For any custom entities in your skill, make sure the values are in the skill's primary language.
You can add and edit custom entities by clicking
in the left navigation of the skill.
If you don't provide custom entity values in the skill's primary language, the skill won't be able to properly process user input that contains any values that need to be matched by a custom entity.
- In the skill, update all of the configuration messages and prompts to use the
primary language:
To access these messages and prompts:
- In the left navigation for the skill, click
.
The messages and prompts are located on the Configuration and Digital Assistant tabs.
- In the left navigation for the skill, click
-
You can’t translate the names of the built-in entities.
-
When you set up your skill this way, the language processing framework detects non-English input and then translates it into English (the language of the training model) behind the scenes. After evaluating the input, it determines the appropriate response and translates it back to the target language.
This can impact translation costs because it requires more calls to the translation service than a skill where the training corpus is already in the English.
Multi-Language Skills with Auto-Translation
For skills that use a translation service, you can enable the skill to automatically detect the user’s language and communicate in that language.
To set this up, you need to update the dialog flow to:
- Detect the user's language.
- Translate the user input so that it can be resolved.
Translation for Skills in Visual Dialog Mode
For multi-language skills designed in Visual dialog mode, here are the steps for setting up translation:
- If you haven't already done so, add a translation service to your skill.
- At the beginning of the flow that you intend to be the starting point of the skill, insert a Detect Language component.
- In the Main Flow, add the Start Skill built-in event and map it to the flow that contains the Detect Language component.
- On the skill's Settings page, select the
Configuration tab and set the Translate User
Input Message and Translate Bot Response
Message properties.
- Set Translate User Input Message to true to translate user input.
- If you are not using resource bundles for the target languages, set Translate Bot Response Message to true.
Translation for Skills in YAML Dialog Mode
For skills designed in YAML dialog mode, you can determine what to have translated
component by component by using either or both the autotranslate
context variable and the component-level translate
property.
- The
autotranslate
context variable applies globally to the whole skill. If you don't specifyautotranslate
, it's value isfalse
. - The
translate
property can be set individually for each component. When thetranslate
property is set for a component, it overrides theautotranslate
value for that component.
For both autotranslate
and translate
, you can set the value as a single Boolean or you can specify separate Boolean values for input and output.
Examples: autotranslate
Context Variable
Here's an example of using autotranslate
to turn on automatic translation for both input and output:
setAutoTranslate:
component: "System.SetVariable"
properties:
variable: "autoTranslate"
value: true
And here's how you could use autotranslate
to translate input by default, but not output:
setAutoTranslate:
component: "System.SetVariable"
properties:
variable: "autoTranslate"
value:
input: true
output: false
You don't have to specify
autotranslation
values that are false. For example, in the previous snippet, you don't need to include the line:
output: false
Examples: translate
Property
Here's an example of setting the translate
property to send both the component's input and output to the translation service that has been specified for the skill:
askName:
component: "System.Text"
properties:
prompt: "${rb.askNamePrompt}"
variable: "name"
translate: true
And here's an example of sending only the component's input to the translation service:
askName:
component: "System.Text"
properties:
prompt: "${rb.askNamePrompt}"
variable: "name"
translate:
input: true
output: false
Opt-In Translation
For skills designed in YAML dialog mode, here are the steps if you want to individually specify which components to translate:
- If you haven't already done so, add a translation service to your skill.
- Make sure that the
autoTranslate
context variable is not set (or set tofalse
). - Above the state for the
System.Intent
component, add the System.DetectLanguage component:detect: component: "System.DetectLanguage" properties: useExistingProfileLanguageTag: true transitions: ...
Note
TheuseExistingProfileLanguageTag
property is used when a skill is part of a digital assistant that has a translation service. This enables the skill to use the language that is detected by the digital assistant immediately. Otherwise, the skill might provide a message or prompt in English before the language is (re-)detected. If the skill is not in a translation-enabled digital assistant, the property is ignored. - In the System.Intent component, set the translate property to
true
.intent: component: "System.Intent" properties: variable: "iResult" translate: true
- For other input components, also set the translate property property to
true
, or set theinput
attribute of thetranslate
property totrue
, e.g.:askName: component: "System.Text" properties: prompt: "${rb.askNamePrompt}" variable: "name" translate: input: true output: false
Example: Multi-Language Skill with Auto-Translation (Opt-In)
metadata:
platformVersion: "1.0"
main: true
name: "AutoTranslatePizzaJoe"
parameters:
age: 18
context:
variables:
size: "PizzaSize"
type: "PizzaType"
crust: "PizzaCrust"
iResult: "nlpresult"
states:
detect:
component: "System.DetectLanguage"
properties:
useExistingProfileLanguageTag: true
transitions:
next: "intent"
intent:
component: "System.Intent"
properties:
variable: "iResult"
translate: true
ShowMenu:
component: "System.CommonResponse"
properties:
processUserMessage: true
translate:
input: true
output: false
metadata:
responseItems:
- type: "text"
text: "Hello ${profile.firstName}, this is our menu today:"
...
...
Opt-Out Translation
For skills designed in YAML dialog mode, here are the steps for using auto-translation by default (and individually specify components to not translate) :
- If you haven't already done so, add a translation service to your skill.
- Add
autoTranslate: "map"
as a variable to thecontext
node.context: variables: ... autoTranslate: "map"
- Within the
states
node, above yourSystem.Intent
component, add aSystem.SetVariable
component. Then set thevariable
property to use theautoTranslate
context variable and set theinput
(and, optionally,output
) attribute of thevalue
property totrue
.setAutoTranslate: component: "System.SetVariable" properties: variable: "autoTranslate" value: input: true output: true transitions: ...
Note
If you are using resource bundles, you'd set theoutput
value tofalse
. - For the next state, add the System.DetectLanguage
component:
detect: component: "System.DetectLanguage" properties: useExistingProfileLanguageTag: true transitions: ...
Note
TheuseExistingProfileLanguageTag
property is used when a skill is part of a digital assistant that has a translation service. This enables the skill to use the language that is detected by the digital assistant immediately. Otherwise, the skill might provide a message or prompt in English before the language is (re-)detected. If the skill is not in a translation-enabled digital assistant, the property is ignored. - For any components that you don't want auto-translated, see the translate property to
false
, e.g.:done: component: "System.Output" properties: text: "${rb('OnTheWay','${size.value}','${type.value}')}" translate: input: true output: false transitions: return: "done"
Example: Multi-Language Skill with Auto-Translation for Input (Opt-Out)
In this example, auto-translation is set up for input, but it is off for output (so that output text can be specified in resource bundles).
metadata:
platformVersion: "1.0"
main: true
name: "AutoTranslatePizzaJoe"
parameters:
age: 18
context:
variables:
size: "PizzaSize"
type: "PizzaType"
crust: "PizzaCrust"
iResult: "nlpresult"
autoTranslate: "map"
states:
setAutoTranslate:
component: "System.SetVariable"
properties:
variable: "autoTranslate"
value:
input: true
output: false
transitions:
next: "detect:
detect:
component: "System.DetectLanguage"
properties:
useExistingProfileLanguageTag: true
transitions:
...
Manipulate Input Before Translation
If you want to be able to manipulate input text before sending it to the translation service, you can use the Translate Input (Visual dialog mode) or System.TranslateInput (YAML dialog mode) component. For example, you might want to process user input to remove some personal data before sending it to the translation service.
sourceString
variable holds the
text to be translated. (This text, for example, may have been gathered by another component.)
After the System.TranslateInput
completes its processing, the English
translation is stored in the translatedString
variable.context:
variables:
autoTranslate: "boolean"
translatedString: "string"
sourceString: "string"
...
states:
...
translateInputString:
component: "System.TranslateInput"
properties:
source: "sourceString"
variable: "translatedString"
transitions:
...
Predominant Language
For skills that you set up to use Platform Version 20.09 or earlier and which have been configured with a translation service, Oracle Digital Assistant automatically assigns a predominant language for that skill, based on the language of the skill's example utterances.
You can find what predominant language has been assigned for a skill by clicking the Settings() icon in the skill's left navbar, selecting the General tab, and checking the value of the Predominant Language property.
For such skills, make sure that all of your intent example utterances, entities, and dialog response text are in the predominant language.
If you are designing the skill to support multiple languages, the predominant language must be English.
For digital assistants that are based on Platform Version 20.09 or earlier, the predominant language is determined by the predominant language of the first skill that you add to the digital assistant. Any other skills that you add to the digital assistant must have the same predominant language.
If the first skill that you add has no predominant language (because no translation service has been specified in the skill), the digital assistant's predominant language is set to English. In this case, you can either add skills that have English as the predominant language (or which have no predominant language set).
For skills and digital assistants that are based on Platform Version 20.12 or higher, a predominant language is not set. Instead, you specify the primary language when you create the skill or digital assistant.
Resource Bundles for Skills
If your skill is designed to handle multiple languages and you want to control the wording for your skill’s responses, use resource bundles. You can provide resources bundles for as many languages and dialects as you need.
Even if your skill is targeted toward only one language, using resource bundles has benefits, such as enabling you to put all of your use-facing text in one place.
There are a number of options for parameterizing resource bundle entries, which enables you to embed variables in the strings. In addition, you can use ICU formatting for bundle entries to help construct the wording of a response depending on how its parameters are resolved. This enables you to do things like adjust wording according to whether something is singular or plural.
Types of Resource Bundle Keys
A skill's user-facing strings come from several parts of the skill. In some cases, a resource bundle key is automatically created for you. In other cases, no key is generated, but you can define one yourself.
Here are the places from where user-facing strings originate and how you can manage them in the resource bundle.
- The Conversation Name field for intents.
When you set conversation names, resource bundle keys are created automatically and populated with the value that you have set for the default language. You can access the bundle keys for conversation names by clicking
and selecting the Intents tab.
- The Answer field for intents (answer intents).
When you set answers in intents, resource bundle keys are created automatically and populated with the answer text in the default language. You can access the bundle keys for answers by clicking
and selecting the Q&A tab.
- The skill's configuration settings (which you access by clicking
and selecting the Configuration tab).
For these settings, resource bundle keys are generated with default values and the setting values are expressed as references to the resource bundle keys. You can edit the values of these keys by clicking
and selecting the Configuration tab.
- Default prompts, labels, and messages that are built into standard dialog flow
components.
If you want to change the default value of any of these properties, you can do so within the resource bundle by clicking
and selecting the Configuration tab.
You don't need to add the property to the component in the dialog flow definition to reference the updated value in the resource bundle.
If you want to change the value of one of those properties for a component in a particular state without changing the default, you add the property to the component in that state.
- Dialog flow strings. For text that you incorporate into your components, you can define your own resource bundle keys and then reference those keys from the dialog flow definition.
You can create and edit these keys by clicking
and selecting the User-Defined tab.
- Prompts and messages from entity definitions. For these strings, you can define your own resource bundle keys and then reference those keys from the fields for these properties in the entity definition.
You can create and edit keys for these strings by clicking
and selecting the User-Defined tab.
Resource bundles are not the mechanism for translating value list entities. Instead, you provide the translation within the custom entity definition. For skills using natively-supported languages, you provide values for that native language. For skills based on a translation service, you provide the translated values as synonyms for the values in the default language.
Create Resource Bundle Keys
Resource bundle keys are used to identify output text that needs to be translated and provide values in one or more languages. Keys are automatically defined for the intent conversation names, the responses for answer intents, and some common properties. However, you need to create keys yourself for other output text that you want to translate, such as text from your dialog flow.
To create resource bundle entries:
-
In the skill's left navbar, click
.
- Click the User-Defined tab.
-
Click Add Bundle.
The Create Entry dialog appears, which enables you to create your first entry in the skill's primary language.
-
Enter the a key (which you use to reference the bundle entry) and its corresponding text. For example, for the user prompt How old are you?, you might enter HowOld in the Key field and then How old are you? in the Text field.
- For Annotation, enter any information that will be useful for those that may need to reference the entry later, such as translators.
-
Click Create Entry.
Add a Language to a Resource Bundle Key
When you create a bundle key, its initial Text value is for the skill's default (i.e. primary or predominant language).
To add text for a bundle key in another language:
-
Select the key and then click Add Language.
-
Complete the Create Entry dialog:
-
Language—Enter or select an IETF BCP 47 language tag like
fr
for French orde
for German. -
Text—The output string. For example, for a French translation (
fr
) of the HowOld key, you’d add a string like quel âge avez-vous ?
-
You can also use more specific locales (such as
en-US
), but they are not useful in most cases. For example, if
you are using a translation service to detect the language, only a two-letter code will
be returned.
If the skill can’t match the input language with a language tag defined in the bundle, it defaults to a less-specific tag (if one is available). If none of the entries match the browser’s language, the skill uses the default entry, English. See Resource Bundle Entry Resolution for details.
Translate Conversation Name
At some points within a conversation, such as when the skill is trying to determine what flow the user wants to follow, the skill may present a dialog that refers to one more intents. In these cases, the skill refers to the intents by their conversation names, for which keys and default entries are generated in the resource bundle.
To provide a translation for a conversation name:
-
Click Resource Bundle in the left navbar (
).
-
Click the Intents tab on the Resource Bundles page.
-
Select the intent
-
Click Add Language.
-
Complete the Create Entry dialog:
-
Language—Add an IETF BCP 47 language tag like
fr
for French,de
for German, oren-US
for U.S. English. -
Text—The output string. For example, for a French translation (
fr
) of the HowOld key, you’d add a string like quel âge avez-vous ?
-
If the intent for which you want to change the conversation name doesn't appear in the list, click

Translate Answers for Answer Intents
When you create an answer intent, a resource bundle key is automatically created for the answer.
To provide a translation for an answer in an answer intent:
-
Click Resource Bundle in the left navbar (
).
-
Click the Q&A tab on the Resource Bundles page.
-
Select the key for the answer that you want to translate.
-
Click Add Language.
-
Complete the Create Entry dialog:
-
Language—Add an IETF BCP 47 language tag like
fr
for French,de
for German, oren-US
for U.S. English. -
Text—The output string.
-
Reference Resource Bundles in the Dialog Flow
To set the output for a built-in component, you reference the message key through the variable rb
(which is reserved for resource bundles).
Here is a simple expression that references a bundle key called
WhatType
to return a simple string:
${rb('WhatType')}
Here is an expression that uses dynamic values. It references a bundle key called
OnTheWay
where size.value
and type.value
are the arguments for the OnTheWay
key.
${rb('OnTheWay','${size.value}','${type.value}')}
You can also create bundle entries with more complex message formats to handle plurals and other cases. See the following topics to learn about the range of message formats and how to reference them in your dialog flow.
Tip:
To test your resource bundles using the tester, set your browser to another language.Message Formats
There are several formats that you can use for your resource bundle messages to handle everything from returning static messages to assembling messages depending on multiple variables.
Simple Messages
For simple static messages:
- As the value for the bundle key, provide plain text. For example:
This is the value of my bundle key
- From the dialog flow or the configuration property, reference the bundle key in the form:
{rb.bundleKey}
or{rb('bundleKey')}
Messages with Parameters
For messages with variables:
- As the value for the bundle key, provide text and include parameters in one of the following formats:
- Named parameters in the form
{parameterName}
- Sequentially-numbered parameters starting with
{0}
- Named parameters in the form
- From the dialog flow or the configuration property, reference the bundle key in the form:
${rb('bundleKey','variable1','variable2',...)}
Example: Message with Named Parameters
Here's an example with two named parameters:
- Resource Bundle Key:
pizzaOnTheWayWithNamedParams
- Resource Bundle Message (in English):
(whereYour {pizzaSizeParam} {pizzaTypeParam} pizza is on the way.
{pizzaSizeParam}
and{pizzaTypeParam}
are parameters for values to be resolved and inserted during the conversation) - Expression for Referencing Resource Bundle Key:
(where${rb('pizzaOnTheWayWithNamedParams','pizzaSizeParam,pizzaTypeParam',pizzaSize.value, pizzaType.value)}
pizzaSize
andpizzaType
are variables defined in the dialog flow)
Example: Message with Numbered Parameters
Here's an example using numbered parameters:
- Resource Bundle Key:
pizzaOnTheWayWithNumberedParams
- Resource Bundle Message:
(whereYour {0} {1} pizza is on the way.
{0}
and{1}
are parameters for values to be resolved and inserted during the conversation) - Expression for Referencing the Resource Bundle Key:
(where${rb('pizzaOnTheWayWithNumberedParams',pizzaSize.value, pizzaType.value)}
pizzaSize
andpizzaType
are variables defined in the dialog flow)
Complex Messages
You can also create complex messages, where the value of one or more variables may affect the surrounding output text. For example, if the response includes a variable for the number of pizzas ordered, you can use a complex message to determine whether to use the singular ("pizza") or plural ("pizzas").
Tip:
When you compose complex bundle entries, you can use this tester to make sure that the entries resolve as you intend:https://format-message.github.io/icu-message-format-for-translators/editor.html.Messages that Handle Both Singular and Plural
For messages that include a variable that expresses a quantity of something, you may need to vary the wording of the assembled message depending on how the variable resolves. And for some languages, you may need to account for more than a simple singular/plural distinction. To handle messages with variables for quantity, you can use a plural
argument in the key's value to specify the different ways the message may need to be constructed.
In a plural argument, part of the message is determined by a numeric value along with grammar rules for the specified language. You define the message text for different cases, depending on how the plural argument resolves. There are several predefined cases, such as one
, two
, few
, many
, and other
. You can also specify a case for a specific number by pre-pending =
to that number (e.g., =3
). Not all of the predefined cases are relevant for every language. For example, for English you might just use =0
, =1
, and other
.
You must always include a case and a message for other
. To include the resolved number in the message text for a case, use #
to output the number.
When you use plural arguments, the format typically looks something like this:
{plural_arg_name, plural,
=0 {Text used when the plural argument resolves to 0}
=1 {Text used when the plural argument resolves to 1}
other {Text used when the plural argument resolves to a value that doesn't match the other cases (in this case 0 or 1)}
}
In the above example 0
, 1
, and other
are the possible quantities. More details on how plural argument types work can be found in the Unicode Locale Data Markup specification.
For details on the plural support for various languages, see the unicode.org plural language rules.
Other Complex Messages
If the content of the message needs to based on other conditions, you can use a select
argument with keywords that you define to assemble the message.
{select_arg_name, select,
keyword1 {Text used when the select argument resolves to keyword1}
keyword2 {Text used when the select argument resolves to keyword2}
other {Text used when the plural argument resolves to a value that doesn't match the other keywords}
}
You can also nest plural and select arguments:
{select_arg_name, select,
keyword1 {
{plural_arg_name, plural,
=0{Text used when the select argument resolves to keyword1 and the plural argument resolves to 0.}
=1 {Text used when the select argument resolves to keyword1 and the plural argument resolves to 1}
other {Text used when the select argument resolves to keyword1 and the plural argument resolves to a value that doesn't match the other cases (in this case 0 or 1)}}}
keyword2 {
{plural_arg_name, plural,
=0 {Text used when the select argument resolves to keyword2 and the plural argument resolves to 0.}
=1 {Text used when the select argument resolves to keyword2 and the plural argument resolves to 1}
other {Text used when the select argument resolves to keyword2 and the plural argument resolves to a value that doesn't match the other cases (in this case 0 or 1)}}}
other {
{plural_arg_name, plural,
=0 {Text used when the select argument resolves to other and the plural argument resolves to 0.}
=1 {Text used when the select argument resolves to other and the plural argument resolves to 1}
other {Text used when the select argument resolves to other and the plural argument resolves to a value that doesn't match the other cases (in this case 0 or 1)}}}
}
For the keyword names, you should only use ASCII alphabet characters (A-Z,a-z).
You can find more details on complex messages at https://unicode-org.github.io/icu/userguide/format_parse/messages/#complex-argument-types.
Referencing Complex Messages
You can reference complex resource bundle messages in one of the following two ways:
- Using a map variable where values for each of the parameters are assembled:
${rb('bundleKey', formatMap.value)}
- Including a list argument with the parameter names followed by arguments for each value:
${rb('bundleKey', 'param1, param2, param3', paramValue1, paramValue2, paramValue3)}
Note
Where the parameter values are strings, they should be enclosed in single quotes ('
).
For further details, see the Complex Argument Types topic in the ICU documentation.
Maps for Complex Resource Bundle Values
If you decide to use map variable to assemble the parameters for a complex messages, here's what you do:
- Declare a map context variable.
context: variables: formatMap: "map"
- Use a Set Variable component to populate the value of the map from other variables.
Here's an example in a YAML-based dialog
flow:
populateMap: component: "System.SetVariable" properties: variable: "formatMap" value: pizzaSize: "${pizzaSize.value}" pizzaType: "${pizzaType.value}" count: "${pizzaNum.value}"
- In the expression where you reference the bundle key, include the map as an argument. For example:
plural: component: "System.Output" properties: # use map variable to resolve text: "${rb('pizzaOnTheWaySingularOrPlural', formatMap.value)}"
Example: Message that Handles Both Singular and Plural Variants
Here's an example of a resource bundle entry for a message that could have either singular or plural content:
- Resource Bundle Key:
pizzaOnTheWaySingularOrPlural
- Resource Bundle Message (in English):
{count, plural, =0 {No pizzas will be delivered.} =1 {Your {pizzaSizeParam} {pizzaTypeParam} pizza is on the way.} other {# pizzas are on the way.} }
- Expression for Reference to Resource Bundle Key:
As you can see, the expression contains two arguments:${rb('pizzaOnTheWaySingularOrPlural','count, pizzaSizeParam, pizzaTypeParam', 'pizzaNum.value, pizzaSize.value, pizzaType.value')}
- A list of parameter names (
count, pizzaSizeParam, pizzaTypeParam
) - A list of values for those parameters (
pizzaNum.value, pizzaSize.value, pizzaType.value
)
- A list of parameter names (
Example: Message with Nested Parameters
{ gender, select,
female
{{count, plural,
=0 {She has not ordered anything.}
=1 {She has ordered only one.}
other {She has ordered #.}}}
male
{{count, plural,
=0 {He has not ordered anything.}
=1 {He has ordered only one.}
other {He has ordered #.}}}
other
{{count, plural,
=0 {They have not ordered anything.}
=1 {They have ordered only one.}
other {They have ordered #.}}}}
- She has not ordered anything.
- She has ordered only one.
- She has ordered 2.
- He has not ordered anything.
- He has ordered only one.
- He has ordered 2.
- They have not ordered anything.
- They have ordered only one.
- They have ordered 2.
2
is given in the above example as the number resolved by the count
argument, but it could be any number other than 0 or 1.
Resource Bundles and Auto-Translation of Skills
Here are the general steps for setting up a skill to use a translation service only for user input while using resource bundles for the skill's responses:
- If you haven't already done so, add a translation service to your skill.
- Use the Detect Language component to determine the language of the user's input.
- Apply resource bundles to handle the skill's responses to the user.
- For any components that reference resource bundles, make sure that the output is
not translated automatically.
- For skills developed in Visual dialog mode, set the Translate Bot Response
Message property on the skill's Settings page to
False
. - For skills developed in YAML dialog mode, you can handle this globally in the skill by
setting the
autoTranslate
context variable to translate input and not translate output. For example:setAutoTranslate: component: "System.SetVariable" properties: variable: "autoTranslate" value: input: true output: false
- For skills developed in Visual dialog mode, set the Translate Bot Response
Message property on the skill's Settings page to
For skills developed in YAML mode, you can also handle this at the component level by using each component's
translate
property and not setting the autoTranslate
variable. For example, to
set up automatic translation for a System.Text
component's input and disable
automatic translation for its output, you might do something like
this: askName:
component: "System.Text"
properties:
prompt: "${rb.askNamePrompt}"
variable: "name"
translate:
input: true
output: false
If your skill uses resource bundles for some components but relies on auto-translation for other components, you can:
- Set the
autoTranslate
context variable totrue
. - Like in the above code sample, set the
translate:input
property tofalse
for each component that uses a resource bundle.
Conditional Auto-Translation
If you have defined resource bundles for some languages but also want to be able to
provide responses for languages for which you don't have resource bundle entries, you can use
FreeMarker expressions to determine how autotranslate
and
translate
resolve. For example, if only English and Dutch resource bundles
are defined, you could conditionally enable output translation for the other languages. Here's
what that might look like in a YAML-based dialog flow:
detectLanguage:
component: "System.DetectLanguage"
properties:
...
...
setAutoTranslate:
component: "System.SetVariable"
properties:
variable: "autoTranslate"
value:
input: true
output: "${profile.languageTag!='en'&& profile.languageTag!='nl'}"
Resource Bundle Entry Resolution
The resource bundle that gets applied depends on the value stored for the two location-specific user
profile variables, profile.languageTag
and
profile.locale
. If both variables are set,
profile.languageTag
takes precedence.
When resolving which language to use, Oracle Digital Assistant first searches for an exact match. If it doesn't find one, it incrementally broadens its search until it succeeds. If it still can't find a match, it returns the default language, which is English (en
).
${profile.locale}
is en-AU-sydney
(and profile.languageTag
isn't set), Oracle Digital Assistant does the following to find the best language match:
-
Searches the bundle by the language-country-variant criteria (
en-AU-sydney
). -
If it can’t find that, it searches the bundle by language and country (
en-AU
). -
Failing that, it broadens its search for language (
en
).Note
profile.locale
supports values in ISO language-country or ISO language_country formats.
Export and Import Resource Bundles
You can export and import resource bundles in the form of a CSV file, which enables you to work with the bundles offline.
The CSV file needs to have the following columns:
languageTag
key
message
annotation
To export a CSV file with the existing resource bundle:
-
On the Resource Bundle page for your skill or digital assistant, click
to export a CSV file with the existing resource bundle.
Even if you haven't yet added any keys to the resource bundle, a file with the required format of the CSV will be exported.
To import a resource bundle file:
- On the Resource Bundle page for your skill or digital assistant, click
.
Internationalize and Localize Custom Component Responses
- Create resource bundle entries in the skill and reference them directly from the custom component. This approach enables you to handle translations of custom component messages in the same place as you do for other messages from the skill.
- Use a system component and resource bundle entries for assembling the translatable strings that incorporate the data output of the custom component. This approach enables you to handle translations of custom component messages in the same place as you do for other messages from the skill while fostering a looser coupling between the custom component and that particular skill.
- If you want to use the skill's translation service to translate the component's responses, set the custom component's
translate
property totrue
. - If your component retrieves and returns backend data that needs to be incorporated into a message and you want to use the skill's translation service to translate the component's responses, store that returned data in a context variable in the dialog flow. You can then reference this variable in a system component.
Reference Resource Bundles from the Custom Component
Just as you can use resource bundles for messages in built-in components, answer intents, etc., you can use resource bundles for your custom components as well. To do so, you:
- Define resource bundle entries in the skill for your message. See Create Resource Bundle Keys.
- Using the Bots Node SDK's
context.translate()
method, reference the resource bundle keys from the custom component code.The
context.translate()
takes a specified resource bundle key name (and any parameters specified in the resource bundle entry) and generates the appropriate FreeMarker template required to load the named resource bundle language string when the conversation is sent back to the user via thecontext.reply()
method. - Use the
context.reply
helper method to print the translated response. For example:context.reply(translate('date.message', dateToday, dayOfWeek ));
- Document all of the resource bundle keys that the custom component references as well as the expected default strings. (Since the custom component directly references the resource bundle key within the skill, there needs to be a high degree of coordination between the developer of the custom component and those building out the skill to ensure that the referenced keys are valid within the skill).
In this example, date.message
is a resource bundle key, dateToday
and dayOfWeek
are variables, and a FreeMarker expression like the following is returned:
${rb('date.message', 'Monday', 'July 12, 2021')}
The context.translate()
method only supports resource bundle values that have no parameters or that use positional (numbered) parameters. For example, in the case of the example date.message
key, it's value might be something like “Today is {0}, {1}”
. Named parameters and complex message formats are not supported.
Use a System Component to Reference a Resource Bundle
You can use a system component to assemble messages using resource bundle entries and data that has been returned from a custom component. You define the base message strings in resource bundle entries. The bundle entries might include parameters for data (such as numbers and dates) that are output from the custom component. Since the base message strings are defined in the dialog flow, this approach ensures that custom components are not dependent on specific implementation code and remain reusable.
Here are the general steps:
- For the custom component, include a required input parameter for the name of the context variable to store the returned data in.
- Since the custom component developer and dialog flow developer may not be the same person or even on the same team, carefully document what data the custom component returns in that variable and make the information available to any custom component consumers so that they understand how to present the returned data to the user in a message.
- In the dialog flow, create a context variable to store the custom component's returned data and pass its name in the required input parameter.
- Define resource bundle entries in the skill for your message. See Create Resource Bundle Keys.
- In the dialog flow, reference the resource bundle entry and fill in any required parameters.
The following sample from a skill developed in YAML dialog mode references a custom
component in the initializeReceipt
state and passes the name of the context
variable (receipt
) that holds the component response and
purchaseId
as input parameters. The printProduct
state
then incorporates the receipt
value as a parameter in a reference to the
resource bundle entry named receiptMessage
.
initializeReceipt:
component: "sample.receipt.dataresponse"
properties:
dataVariable: "receipt"
purchaseId: "${purchaseId.value}"
...
printProduct:
component: "System.CommonResponse"
properties:
keepTurn: true
metadata:
responseItems:
- type: "text"
text: "${rb('receiptMessage','${receipt.value}')}"
The custom code for accessing these input parameters might look something like the following code:
module.exports = {
metadata: () => ({
name: 'myComponent',
properties: {
dataVariable: { required: true, type: 'string' },
purchaseId: { required: true, type: 'string' },
},
...
// Retrieve the value of the 'dataVariable' component property.
const { dataVariable } = context.properties();
if (!dataVariable) {
context.transition();
done(new Error('The state is missing the dataVariable property.'));
}
...
// Retrieve the value of the 'purchaseId' component property.
const { purchaseId } = context.properties();
if (!purchaseId) {
context.transition();
done(new Error('The state is missing the purchaseId property.'));
}
...
context.setVariable(dataVariable, data);
context.transition();
done();
}
}
Send Responses Directly to the Translation Service
If you don't have a way of knowing what the component's response text will be (e.g. if it is queried from a remote backend), you can use the skill's translation service to translate the responses. To do so:
- Make sure the component is set up to have its output sent to the translation service by defining the
translate
property on the component and setting it totrue
. - In the custom component, use the
context.reply
helper method to return the response.
This approach only works with skills that are set up in the Translation Service language mode.
Use a System Component to Pass the Message to the Translation Service
Custom components that query backend services might return data in a complex format like an object or an array of objects. If you are using a translation service, these data objects can't be sent to the translation service as is. Instead, you need to form a message that references any necessary attributes of the data object individually.
- For the custom component, include a required input parameter for the name of the context variable to store the returned data in.
- Since the custom component developer and dialog flow developer may not be the same person or even on the same team, carefully document what data the custom component returns in that variable and make the information available to any custom component consumers so that they understand how to present the returned data to the user in a message.
- In the dialog flow, create a context variable to store the custom component's returned data and pass its name in the required input parameter.
- Using the information in the context variable, assemble the response in a system component, like Common Response.
- Make sure that the skill is configured for auto-translation.
- For skills developed in Visual dialog mode, set the Translate
Bot Response Message property on the skill's
Settings page to
true
. - For skills developed in YAML dialog mode, you can handle this globally in
the skill by setting the
autoTranslate
context variable. For example:setAutoTranslate: component: "System.SetVariable" properties: variable: "autoTranslate" value: input: true output: true
- For skills developed in Visual dialog mode, set the Translate
Bot Response Message property on the skill's
Settings page to
dialogVar
. The data object that’s passed from the custom component to this context variable is {product: "an apple", type: "fruit", origin: "Spain" }
. printProduct:
component: "System.CommonResponse"
properties:
keepTurn: true
metadata:
responseItems:
- type: "text"
text: "The product in your cart is a ${dialogVar.value.type}. It is
${dialogVar.value.product} from ${dialogVar.value.origin}"
translate: true
The custom code for accessing this input parameter might look something like the following code:
module.exports = {
metadata: () => ({
name: 'myComponent',
properties: {
dialogVar: { required: true, type: 'string' },
},
...
// Retrieve the value of the 'dialogVar' component property.
const { dialogVar } = context.properties();
if (!dialogVar) {
context.transition();
done(new Error('The state is missing the dialogVar property.'));
}
...
context.setVariable(dialogVar, data);
context.transition();
done();
}
}
Detect the User Language in a Custom Component
If the custom component needs the user's language to do things like provide correct date formats, you can provide it to the component in one of these ways:
- Access the
profile.locale
andprofile.languageTag
variables from the custom component code as shown in the following example://detect user locale. If not set, define a default const locale = context.getVariable('profile.locale') ? context.getVariable('profile.locale') : 'en-AU'; //Make sure locale is returned with hyphen, not underscore. JavaScript requires a hyphen. const jsLocale = locale.replace('_','-'); //when profile languageTag is set, use it. If not, use profile.locale const languageTag = context.getVariable('profile.languageTag')? context.getVariable('profile.languageTag') : jslocale;
- Pass the values of
profile.locale
and/orprofile.languageTag
as input parameters to the component.
If both variables are set, profile.languageTag
takes precedence in the skill.
Resource Bundle Entries for Skill Configuration Settings
Starting with platform version 21.04, resource bundle entries are automatically created for skill configuration settings. If your skill is based on platform version 21.02 or earlier, you can upgrade to 21.04 or higher to have these entries generated for you.
Here is a list of all of the system resource bundle entries for skills along with their default values.
Resource Bundle Entry | Default English Text | Entry Description |
---|---|---|
systemComponent_AgentConversation_conclusionMessage |
Chat session ended. Thanks for chatting with us. |
The message shown to the user when human agent ends the chat. |
systemComponent_AgentConversation_errorMessage |
Chat session error. The reason is: {0}. |
The message shown to the user when Digital Assistant experiences errors with the agent chat system. |
systemComponent_AgentConversation_exitKeywords |
bye, take care, see you, goodbye |
Comma-delimited list of keywords the user can use to end the chat with the agent. |
systemComponent_AgentConversation_expiryMessage |
Chat session expired. Thanks for chatting with us. |
The message shown to the user when the chat session expires. |
systemComponent_AgentConversation_userLeftMessage |
User left the chat. |
The message shown when the user has exited the chat. |
systemComponent_AgentConversation_waitExpiryMessage |
The request for live chat expired while waiting for an agent. |
The message shown to the user when the chat expires while waiting for an agent. |
systemComponent_AgentInitiation_agentActionsMessage |
\n Here are the available actions that you can send to transfer the conversation back to the bot. Prepend the action with a forward slash (for example, /actionName).\n |
Message preceding the list of agent actions. |
systemComponent_AgentInitiation_errorMessage |
Error transferring to agent. The reason is: {0}. |
The message shown to user when system error occurs during chat initiation with agent. |
systemComponent_AgentInitiation_rejectedMessage |
Agent rejected. |
The message shown to the user when human agent rejects the chat request. |
systemComponent_AgentInitiation_resumedMessage |
Resuming chat with agent |
The message shown to the user when the chat with human agent is resumed. |
systemComponent_AgentInitiation_waitingMessage |
Agent chat session established, Waiting for agent to join. |
The message that's shown to users when they are waiting for a human agent. |
systemComponent_AgentTransfer_acceptedMessage |
The chat has been transferred to another agent. |
The message that's shown to the users whenever a human agent accepts the chat request. |
systemComponent_AgentTransfer_errorMessage |
We were unable to transfer you to another agent because there was a system error. |
The message shown to the user when Digital Assistant experiences trouble with the agent chat system. |
systemComponent_AgentTransfer_rejectedMessage |
Agent rejected. |
The message that's shown to the users whenever a human agent rejects the chat request, 'maxEngagementsInQueue' is exceeded, the 'allowTransferIf' condition is not met, or the estimated wait time exceeds 'maxWaitSeconds'. |
systemComponent_AgentTransfer_waitingMessage |
Agent chat session established, Waiting for agent to join. |
The message that's shown to users when they're transferred to a human agent. |
systemComponent_Feedback_feedbackPrompt |
How would you rate this
conversation? |
The prompt that displays to users for selecting a rating for the conversation. |
systemComponent_Feedback_invalidValuePrompt |
Value submitted for feedback rating is invalid.
Please try again |
The prompt that displays to users after after they've entered an invalid value for the conversation rating. |
systemComponent_Feedback_skipLabel |
Skip |
The label for the skip button that user's select when they decline to provide feedback. |
systemComponent_Feedback_textFeedbackPrompt |
Any feedback? |
The prompt that asks users to provide feedback when they give a below-the-threshold rating. |
systemComponent_Feedback_thankYouPrompt |
Thank you |
The prompt that's displayed to the user when none of the
Feedback component transitions (above ,
below , or cancel ) have been
defined. The skill outputs the Thank you prompt in the
absence of these transitions.
|
systemComponent_IntelligentAdvisor_answerNotValid |
The answer is not in the correct format. Try again. |
Message that's displayed for Intelligent Advisor interview inputs of type Masked when the user's answer doesn't conform to the specified input mask. |
systemComponent_IntelligentAdvisor_defaultValue |
Suggested value is {0}. |
Text that's added to a question when the Intelligent Advisor interview input has a default value. |
systemComponent_IntelligentAdvisor_doneHelp |
When you are done with the upload, say {0}. |
Help message that's displayed for Intelligent Advisor interview inputs of type Upload. |
systemComponent_IntelligentAdvisor_doneLabel |
/done |
The text that users have to type to indicate that they are done uploading a file. |
systemComponent_IntelligentAdvisor_endLabel |
Interview ended |
The label that is shown in the chat at the end of the interview. |
systemComponent_IntelligentAdvisor_exitLabel |
/exit |
The text that users have to type to indicate that they want to exit the interview. |
systemComponent_IntelligentAdvisor_explanationAskLabel |
Do you want to see the explanation? |
The question that is asked when showExplanation is set to 'ask'. |
systemComponent_IntelligentAdvisor_maskLabel |
Answer format: {0} |
Text that's added to a question to display the expected format for Intelligent Advisor interview inputs of type Masked Text Box. |
systemComponent_IntelligentAdvisor_noLabel |
No |
The label to use to represent Boolean FALSE values. |
systemComponent_IntelligentAdvisor_numberMinMax |
Enter a number between {0} and {1}. |
Message that's displayed when the user enters a value outside of the specified range for an Intelligent Advisor interview input of type Slider. |
systemComponent_IntelligentAdvisor_outOfOrderMessage |
You have already answered this question. When you want to step backwards to change a previous answer, say {0}. |
Error message that's displayed when the user taps a button in a previous Intelligent Advisor interview message. |
systemComponent_IntelligentAdvisor_resetLabel |
/reset |
The text that users have to type to indicate that they want to go back to the first question. |
systemComponent_IntelligentAdvisor_resumeSessionPrompt |
Do you want to restart the interview from where you previously left? |
Question that is asked if the user starts an interview that they had previously left before the interview completed. |
systemComponent_IntelligentAdvisor_uncertainLabel |
Uncertain |
The label that appears for optional values and is what the user can type if they don't know the value. |
systemComponent_IntelligentAdvisor_undoLabel |
/back |
The text that users have to type to indicate that they want to go back to the previous question. |
systemComponent_IntelligentAdvisor_yesLabel |
Yes |
The label to use to represent Boolean TRUE values. |
systemComponent_IntelligentAdvisor_yesNoMessage |
Enter either {0} or {1} |
Message that's displayed when the user enters an invalid answer for Intelligent Advisor interview inputs of type Boolean Radio Button. |
systemComponent_Intent_optionsPrompt |
Do you want to |
The prompt shown to the user when there are multiple top intents within the confidence win margin. |
systemComponent_Intent_optionsQnaLabel |
View Answers |
The label of the action in the options (see optionsPrompt) that will take the user to the QnA component to display the matches. |
systemComponent_KnowledgeSearch_defaultAttachmentLabel |
Download |
The default label to use for the result card's URL action that is linked with an attachment of the search result if that attachment does not have a display name configured already. |
systemComponent_KnowledgeSearch_noResultText |
Sorry, no result was found in the knowledge search. |
The text to output when no search result is available. |
systemComponent_KnowledgeSearch_resultLinkLabel |
View Details |
The label to use for the result card's URL action that's linked to the web version of the knowledge article. |
systemComponent_OAuth2AccountLink_cancelLabel |
Cancel |
The label for the cancel button that lets users leave the state without invoking the authentication dialog. |
systemComponent_OAuth2AccountLink_linkLabel |
Get an access token |
The label for the button that invokes the authentication dialog. |
systemComponent_OAuth2AccountLink_prompt |
Please sign in |
The message that tells users to sign in now. |
systemComponent_OAuthAccountLink_cancelLabel |
Cancel |
The label for the cancel button that lets users leave the state without invoking the authentication dialog. |
systemComponent_OAuthAccountLink_linkLabel |
Log In |
The label for the button that invokes the authentication dialog. |
systemComponent_OAuthAccountLink_prompt |
Please tap on the link to proceed |
The message that tells users to sign in now. |
systemComponent_QnA_answersLabel |
Answers |
The label for the action to view answers in a particular category. |
systemComponent_QnA_categoriesLabel |
Categories |
The label for the action to display the categories that match the user utterance. |
systemComponent_QnA_exitLabel |
Exit Questions |
The label for the exit questions action. |
systemComponent_QnA_moreAnswersLabel |
More Answers |
The label for the action to paginate to next set of answers. |
systemComponent_QnA_moreCategoriesLabel |
More Categories |
The label for the action to paginate to next set of categories. |
systemComponent_QnA_subCategoriesLabel |
Sub-Categories |
The label for the action to display sub-categories within a given category. |
systemComponent_QnA_viewAnswerLabel |
View |
The label for the action to view answer details. |
systemComponent_ResolveEntities_defaultDisambiguationPrompt |
Please select one value for {0} |
Default message shown when the user entered ambiguous input causing multiple entity matches. |
systemComponent_ResolveEntities_defaultPrompt |
Please enter {0} |
Default message shown to prompt the user for input. |
systemComponent_ResolveEntities_showMoreLabel |
Show More |
The label used for the forward pagination button when the number of enumeration values, or disambiguation matches exceeds the 'Enumeration Range Size' property of the composite bag item. |
systemComponent_ResolveEntities_showPreviousLabel |
Show Previous |
The label used for the backward pagination button when the number of enumeration values, or disambiguation matches exceeds the 'Enumeration Range Size' property of the composite bag item |
systemComponent_SelectCalendarEvent_prompt |
You have the following meeting(s): |
The text that appears before the list of meeting. |
systemComponent_Webview_cancelLabel |
Cancel |
The label of the cancel button to leave this state without invoking the webview. |
systemComponent_Webview_linkLabel |
Tap to continue |
The label of the button to invoke the webview. |
systemComponent_Webview_prompt |
Please tap on the link to proceed |
The message for the user to tap on the link to invoke the webview. |
systemConfiguration_autoNumberPrefixes |
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 |
The prefixes used for auto-numbering postback action labels. |
systemConfiguration_autoNumberPrefixSeparator |
. |
The separator used between the number prefix and the postback action label. |
systemConfiguration_errorExpiredSessionPrompt |
Your session has expired. Please start again. |
The message when the session has expired. |
systemConfiguration_errorMaxStatesExceededPrompt |
Your session appears to be in an infinite loop. |
The message when the bot appears to be in an infinite loop. |
systemConfiguration_errorUnexpectedErrorPrompt |
Oops I'm encountering a spot of trouble. Please try again later... |
The message when there is an unexpected error. |
systemConfiguration_internalWelcomeMessage |
help |
The internal message sent to the skill when a channel handles the event that a new user has gotten access to the skill. The reply to the internal message is sent as welcome message to the new user. |
systemConfiguration_oauthCancelPrompt |
Authentication canceled. |
The message when OAuth authorization is canceled. |
systemConfiguration_oauthSuccessPrompt |
Authentication successful! You can return to the conversation. |
The message when OAuth authorization succeeds. |