You have a built a canvas app and you need to roll out your app in different languages for users accessing from different regions. If this is your requirement, this blog might just help you.
Basically we need to implement multi-lingual capability in canvas app. Now there can be many ways to implement this. But here I am going to discuss about a very simple technique on how to achieve the multi-lingual capability in canvas app.
The first thing we need to get is the language of the logged-in user. But how do we get it?
Canvas apps has built in function called Language() to give you just that. Below is the Language function in action.
So one problem is sorted. But now lies the big problem. How to translate?
Power Apps have a connector for Microsoft Translator. I go ahead and add it.
You will be asked to enter a subscription key. If you don’t have one, you can leave it blank to use an internal shared key.
So we have the Language of the logged in user and also we have set up the connection to the Translator. Now it’s time to put them together.
Below is a banner which displays welcome message to the user.
The keyword “Welcome ” we need to show in the user locale. For that I go ahead and put the following code.
MicrosoftTranslator.Translate("Welcome ", Language()) & User().FullName
And it displays the welcome message in the language of the user. In the below screen, I have hardcoded the language to french (fr-FR) to mimic a french locale user.
And it works as expected.
That’s the good part. But there are certain drawbacks
- Each translation is a service call across the network. Basically it uses the Azure cognitive service underneath. It’s better to cache the multilingual during app start but that too have consequences on performance. So choose carefully.
- The translation using this process is mechanical and as-is. The final outcome may sometime not make sense in the translated language.
Hope this helps and gets you started in your multi-lingual journey with canvas apps.
You will also like the below posts
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.