Automatic translation of visuals labels in Power BI reports is possible using conditional formating, Tabular Editor and an Excel template. At the moment, labels are mostly titles. In the future, other labels will be translatable as soon as they will accept conditional formating (visual header tooltip, legend name, …).
Please watch this 4 mn video for an overview of the translation solution :
Step 1 : Install the Excel plugin
- Open the Excel file
- A new tab “T-BI-P” appears
- Select the “Visuals” sheet
Step 2 : Load and translate labels in the Excel file
- Click on “Power BI desktop file” button and select the pbix or pbit file
- Click on “Load visuals” button so the plugin scans the report and populates the Excel sheet with its labels. Did you notice new labels are coloured in yellow ? I will explain it further in another post. The “Visual name” column contains the visuals id. The green column contains the labels text. This is your reference text which will be used as the source text for automatic translation
- Then you need to set the “Localization codes” with the sames codes you have in tabular editor
- Select “Translation languages” with the dropdown list
- Fill in the “Validators”. This is not mandatory but might be useful in case different people will validate translations
- Copy visuals labels into “Visual name” column. Even though this step is optional, it helps naming the measures in a readeable way
- Select a cell in the column to translate and click on the “Translate all lines” button to translate labels automatically
- Take care to validate translations or to ask validators to do it for you
- Then click on “Save labels” button. This will create the “TE objects.tsv” file. It will be used by Tabular Editor. A tsv file is a text file containing data separated by a tab character
Step 3 : Create measures in Tabular editor
The file created by the plugin will be used to create measures automatically in Power BI desktop using Tabular Editor.
Tabular Editor is a powerful tool for tabular model edition created by Daniel Otykier : https://tabulareditor.com/
Detailed presentation : https://powerbi.tips/2020/04/tabular-editor-rocks/
As long as the XMLA read/write endpoint access is in preview, you need to activate this feature in Power BI desktop settings under Options / Global / Preview features
Please be careful using it and work only on copies of your reports. I suggest you activate it, then make your tests on a copy of your report and then unactivate it.
Have a look at Imke Feldmann’s warning : https://www.thebiccountant.com/2020/04/13/power-bi-store-datasets-in-enhanced-metadata-format-warning/
However, you can create measures manually until the XMLA endpoint will reach general availability
Open a model in Tabular Editor. Please check it’s documentation in the wiki of the GitHub repository : https://github.com/otykier/TabularEditor/wiki
The script “Create visuals translations measures.csx” will create measures automatically into the model. It can be loaded into Tabular editor this way :
- Open “Advanced Scripting” tab
- Click on the “Open a C# script from a file”
- Review the parameters in the script
- Click on “+” button
- Give a name to the custom action and check at least the “Model” checkbox then click “Ok” button
- Click on the “Play” button when you want to execute the script or right click on the “Model” in the tree and select “Custom actions/your custom action name”
- Redo all these steps each time you get a new version of the script !
You noticed the “Method” parameter allows to select a method between “USERCULTURE” and “SLICER”. Be sure to read this post to understand the method which is more appropriate for your use case : https://thebipower.fr/index.php/2020/05/07/visuals-labels-translations-in-power-bi-reports/
The pbix file contains examples of both methods.
When you execute the “Create visuals translations measures” script, visuals labels are read from the “TE objects.tsv” file. For each label, a measure is created by Tabular Editor.
Save modifications to the model.
Step 5 : Modify visuals labels in Power BI desktop
Follow the steps in the following post and use the Excel file as a source for translations : https://thebipower.fr/index.php/2020/05/07/visuals-labels-translations-in-power-bi-reports/
Automatic translation of visuals labels in Power BI reports makes the translation process much easier. In a future post, I will explain how to manage the translations life cycle. This way, you will be able to maintain translations easily when the report will evolve (visuals creation or deletion).
See also a post about automatic translation of tabular model (columns and measures names) : https://thebipower.fr/index.php/2020/04/12/automatic-translation-of-tabular-model/