Most of the global teams are spread out in many countries. That’s adds a very interesting aspect to all our bots/app
Most of the global teams are spread out in many countries. That’s adds a very interesting aspect to all our bots/app implementations which need multilingual support
In this blog, we will look how to use Azure AI which can provide multilingual support for apps and bots. This will be useful in many scenarios, some of which are:
- Language agnostic bots that works across multiple regions
- Language agnostic app that works based on the user locale
- Language independent resource support on web app
- Business requirement which require support for real time language translation
The architecture for this implementation is simple. Here is one of the example architectures but could be derived to any preferred ones.
Since it is beneficial to make it as real time as possible, create an Azure Function or like host the multilingual conversion using a HTTP call. And we will need the Azure AI Text Analytics endpoint for the conversion.
For this example, we will use an Azure Function bot service which provides us with the input from the user. Here is link to the Git repo with the Bot Service code. More details about the code and snippets are provided below.
1. Firstly, we will need to intialize the text conversion class with the API key of the Text Analytics service.
2. Before the conversion, we need to first determine the locale of the text provided. In this case, the bot is hosted across many regions, so we mayn’t know where the request is coming from.
3. After the locale is determined, we can call the Text Conversion endpoint to convert the text into the required language. In this case, it is going to be English.
4. This text can then be used by the bots to determine the intents for further processing or the app for its business logic
In this blog we saw we could use the Azure AI to get the text converted in the destination language type. For this blog, I am converting them to English but could be converted to any language of choice. After the target language is acquired we could use it as needed.