A common requirement for bots is to support multiple languages. To address this requirement, Oracle Intelligent Bots provides the ability to configure translation services from Google and Microsoft to auto-translate user input messages and bot responses. If you don’t want bot responses to be auto-translated then a second option is to use Resource Bundles instead.
All the before mentioned options work great for building multi lingual bots, but require messages to be defined in the dialog flow, or saved in context variables. This excludes custom components that directly write user responses to the message channel using the bot SDK conversation.reply( … ) function.
Without going into a longer discussion of when custom components should write message responses directly to a message channel and when they should save messages or data in a context variable, we simply accept the fact that there are use cases for custom components to be self-contained. This however then bears the question of how to implement translations for those responses.
To translate bot responses sent directly from a custom component, you have two options
- Call a translation service from the custom component implementation code before sending a message. This option is suitable if the messages are not composed in the custom component but queried from a remote backend. Here auto-translation will help making the strings available in the bot user preferred language.
- Use message bundles to provide translated responses for the languages you want the bot to support. Message bundles can use placeholders in the translated strings for the custom component to insert data value at runtime. Message bundles in custom components are a viable option if the custom component queries data from a remote service to integrate in a bot response.
The article (readme), and its sample, shows a simple solution to implement message bundle support in custom components. You can leverage the sample sources in your own custom component projects, and the readme in the sample tells you how. Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.