Reputation: 1
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
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
Reputation: 37
Localization or translation in Power BI can be achieved through XMLA endpoint.
Prerequisite
Steps-
Link for detailed steps blog article.
Upvotes: 0
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