How to create a Multilingual Power Apps using a language file stored in SharePoint

This article will explain how to create a multilingual Power Apps based on a JSON language file stored in SharePoint.
The solution provided here is one of many available solution that can be built to implement multilingual Apps.

Here’s the final rendering:

Final Rendering

Step 1 – The Power App

For this example I will use a very simple PowerApp with only a couple of controls but it can be extended to many labels on many screens 🙂

So here’s what my app looks like:

Multilingual App

It contains a couple of controls and a dropdown list to select the language the user wants to display.

Perform Step 2 and 3 and then come back here for the formulas used in the PowerApp

The formulas used to process the language file are pretty simple and looks like:

OnStart function to process the language file

Details of the formulas:

1) Save the profile of the current user in a global variable.
Set(MyProfile,Office365Users.MyProfileV2())

2) Run the flow created in Step 3 and save the result in a global variable
Set(LanguagePack,’Dev-GetLanguagePack’.Run());

3) Set a global variable with the current language based on the user settings or the default language found in the language file

Set(
CurrentLanguage,
If(
IsBlank(MyProfile.preferredLanguage),
First(
Filter(
LanguagePack,
IsDefault = true
)
),
First(
Filter(
LanguagePack,
Label = MyProfile.preferredLanguage
)
)
)
)

Now that we have the current language, we can use this variable to set the properties on our controls.

Controls formulas details

DropDown list select language

DropDown list select language
PropertyValue
ItemsLanguagePack.Label
DefaultCurrentLanguage.Label
OnChangeSet(
CurrentLanguage,
First(Filter(LanguagePack,Label = Dropdown1.Selected.Label))
)

Other Controls

ControlPropertyValue
LabelTextCurrentLanguage.Screen1.MainScreenTitle
Text InputHintCurrentLanguage.Screen1.HintText
ButtonTextCurrentLanguage.Screen1.Button

Step 2 – The JSON file

In this case I wanted the file to be editable by another team so I chose to store it in a document library. (Everyone that’s using the App should have at least read access on this file)

Here’s what the file looks like. It’s an example and as it’s JSON you can create your own model. For this example I wanted to keep it simple with 2 languages and a couple of labels on 1 screen.

Language file

Step 3 – The Flow to link the file to the App

In order for PowerApp to process a JSON string, it must comes from the response of a flow using the Response Action which must contain the schema of the JSON (otherwise you’ll get a boolean response).

The flow in itself is pretty simple and looks like that:

Flow to read the language file