Power Apps: Creating Multilingual Canvas Apps
Microsoft Power Apps are powerful ways of creating business applications in a smaller scale than Dynamics 365 solutions. With Canvas Apps as one type of Power Apps, there are even more possibilities and features included in the newly created Power Platform: The additional layer on top of the Dataverse allows you to connect to hundreds of data sources to read from and write to. However, there are also some features missing which are natively implemented in the CDS and therefore in Model-Driven Apps as well. One of them is the multi-language (multilingual) support which I’m going to cover in this blog post.
Before we start thinking about how to implement a multilingual support, let’s first talk about the basics. Generally spoken, we need to consider three main aspects:
|Canvas Apps with multilingual support
|Start with a simple application for testing
|Database with language strings
|Dataverse as a native and very powerful data source which is natively integrated into the platform
|Management of language strings
|Model-Driven app as an admin app
As with many Power Apps project, it’s recommended to create an admin app for administrative purposes. The admin app can be a simple Model-Drive App.
The architecture is the key part of this blog post. First of all, we have to create a new entity which I name Canvas_Apps_Languages. The entity contains two fields:
|name (primary field)
|display name of languages, e.g. “German” or “English”
The second entity will be named Canvas_App_Translations. This entity holds all translation records and should contain three fields:
|name (primary field)
|reference to a record in the entity Canvas_Apps_Languages
|key which will be used in the Canvas App to identify the correct record of this entity for the individual purpose of the translation, e.g. for a button in the Canvas App
With this database structure set up, you can easily create a Model-Driven app with both entities as a part of it in the sitemap which you can configure through the app designer.
Let’s jump to the part where we create the Canvas App with the multilingual support. Within that app, we have to first connect the CDS data source and both entities to it. Then, as in the following example, you can create a button named Back and some buttons to choose the language. For me, that’s DE, EN and FR.
With this test application, I’d like to demonstrate a very simple but descriptive scenario: The Back button should change its text depending on which language is currently selected. Therefore, we need to create a formula on the Text property of the Back button:
btnBack.Text = LookUp(Canvas_App_Translations, key = "btnBack" And language = strAppLanguage, name)
With this formula, we lookup a specific record in the Canvas_App_Translations entity. The records are being filtered by the key for the specific scenario (e.g. our text for the button) as well as by the language. The currently selected language is saved in the variable strAppLanguage and set by pressing one of the buttons for choosing the app language.
The following graphic displays the described scenario in a simplified way:
Please note that this graphic does not cover the entity Canvas_Apps_Languages which should be related to the entity Canvas_Apps_Translations through a lookup field on that entity.
This fairly easy scenario can be applied to much more complex scenarios – however, the basic structure will remain the same.
Questions & Answers
How can I build multilingual Canvas Apps (Power Apps)?
You can build multilingual Canvas Apps (Power Apps) by creating two entities with languages and translation strings in Microsoft Dataverse. With a simple lookup formula, you can fetch the desired language strings.
How can I set a default language for a user in Canvas Apps (Power Apps)?
I recommend to add a lookup field to the new languages table in the user table (systemusers). You can fetch this information on App.OnStart by comparing User().Email with the email address of the systemusers.
Which data structure do I need for a multi-lingual Canvas App (Power App)?
You need two additional tables: Canvas_App_Languages for languages (i.e. “German” or “English”) and Canvas_App_Translations for translation strings (i.e. “Zurück” and “Back”) for a button to navigate back. The Canvas_App_Translations table should contain a lookup to the Canvas_App_Languages table as well as a key (for the lookup from the Canvas App) and a name (for the actual display name).
Can I use multilingual Canvas Apps (Power Apps) with offline functionality?
Yes, that’s possible! You simply have to store the data offline. Read my article for a full tutorial.