payal takawale
payal takawale

Reputation: 1

How to do localisation in Power BI using Microsoft translator and how we can integrate Microsoft translator with Power BI?

I am trying to integrate Azure translator with power BI to convert all my data into different languages depending on the user and respective language code to generate a Power BI report accordingly in different languages.

I have already created a Azure account and opted azure cognitive service from marketplace and signed in to the Azure text translator.

I followed following YouTube link but it seems that power BI has removed the 'Azure Marketplace' option from get data section in Power BI Desktop.

https://www.youtube.com/watch?v=jZQ4BZmtseo

So tried different methods in the following blogs but, didn't find proper solution to the problem

https://datachant.com/2017/01/07/translate-text-power-bi-azure-translator/

Also, I tried different codes in F# in Power BI blank query and tried to invoke that function into my data set but didn't work for me.

Can someone please help me to write some function in Power BI to integrate Microsoft translator or is there any other method present using which I can achieve the same?

Upvotes: 0

Views: 2045

Answers (3)

PunchBird
PunchBird

Reputation: 109

I managed to make it work with a Custom Function. Here are the instructions:

First, create a Custom Function in your report by adding a blank query in the Power Query Editor using the following code (replace YOUR_API_KEY, YOUR_LOCATION and YOUR_TARGET_LANGUAGE):

(text) => let
    apikey      = "YOUR_API_KEY",
    location    = "YOUR_LOCATION",
    contenttype = "application/json",
    endpoint    = "https://api-eur.cognitive.microsofttranslator.com/translate?api-version=3.0&to=YOUR_TARGET_LANGUAGE",
    jsontext    = Text.FromBinary(Json.FromValue(Text.Start(Text.Trim(text), 5000))),
    jsonbody    = "[ { text: " & jsontext & " } ] ",
    bytesbody   = Text.ToBinary(jsonbody),
    headers     = [#"Ocp-Apim-Subscription-Key" = apikey, #"Ocp-Apim-Subscription-Region" = location, #"Content-Type" = contenttype],
    bytesresp   = Web.Contents(endpoint, [Headers=headers, Content=bytesbody, ManualStatusHandling = {404, 400}]),
    jsonresp    = Json.Document(bytesresp)
in  jsonresp

Then, go click on the query that contains the column with text you want to have translated and under the tab 'Add Column' click on the button 'Invoke Custom Function'. Then, give the to be added column that will contain the translation a name, select the custom function from the drop-down list and then select the column to be translated and click 'OK'. Expand the resulting column as required to display the translations.

Upvotes: 0

Prashant Kumbharkar
Prashant Kumbharkar

Reputation: 37

Localization or translation in Power BI can be achieved through XMLA endpoint.

Prerequisite

  1. XMLA Write feature needs to be enabled on Power BI service.
  2. Install Tabular Editor Tool.

Steps-

  1. Open Power BI report in Power BI Desktop and Click on 'Tabular Editor' from External Tools tab from Menu section.
  2. Right click on 'Translation' and select 'New Translation' if you want to add new culture for translation like fr-FR for French. Or you can export existing translations using 'Export 1 translation..' option. It will export the file in JSON format.
  3. Exported JSON translation file has 'cultures' tag. It contains translation mappings for Table, Measures and Column names. You can add new by copying existing cultures block and replace your column names with actual translations.
  4. Once you are done with changes; right click on 'Translations' and click Import Translations.
  5. That's it. Now you can display localized labels by switching between various languages. Even you can pass language culture to Power BI report dynamically from an application using Power BI embedded APIs.

Link for detailed steps blog article.

Upvotes: 0

Ali Heikal
Ali Heikal

Reputation: 4113

If you can't translate the data on the spot using Power BI, then a workaround would be to translate your source data to maybe contain a duplicate of each table (one for each language), then create duplicate reports on Power BI (one for each language) as well.

Upvotes: 0

Related Questions