Introduction
Creating multilingual apps has become a necessity. Especially since a lot of apps these days are being used by users across different countries. Implementing it is actually way easier than how it sounds.
Implementing localization for multilingual apps
There are multiple ways to localize an app. But the one we followed in the Dataverse for Teams sample apps seems to be one of the most optimized ones. The idea is to create localized versions of all the text that is used in the app, in all the languages you want to localize the app in. Here are the steps:
- Say a label's text property is set to "Hello" and that you want to localize the app in 5 different languages.
- Create have 5 rows in an excel, as part of a table, one for each language with the same ID.
- The ID is something you can come up with yourself. For example, I would set the ID for this one to be lblWelcome__Text.
- Import the excel into a collection in the app. This is so that all the localized text is within the app. And you wouldn't need to make external data calls. Use the "Import from excel" data source. And do this in the app OnStart property. Use the following code:
ClearCollect( colLocalizations, tblLocalizations );
- Also, capture the user's language into a variable. Also, in the app's OnStart property. Use the following code:
Set( gblUserLanguage, Switch( Left( Language(), 2 ), "de", "de-DE", "en", "en-US", "es", "es-ES", "fr", "fr-FR", "it", "it-IT", "ja", "ja-JP", "nl", "nl-NL", "pt", "pt-BR", // Default "en-US" ) );
- The excel should like this:
- Finally, set the Text property of the label to:
LookUp( colLocalizations, TextID = "lblWelcome__Text" && LanguageID = gblUserLanguage, Text )
In the demonstration below, I am using a dropdown for languages to show how the app will behave for different users:
Stay tuned for the remaining 17 tips!
Recent articles
- H – Horizontal scrolling in a gallery!
- G – Geofencing – How to implement in Power Apps?
- F – ForAll & network error – How to make it work?