Sunday, 25 March 2018

Text Translation on Office 365 SharePoint

Views
Let us look how the text added to Office 365 SharePoint list are translated and saved back to SharePoint using Microsoft Flow and Translator.

Consider a business scenario of having multi-lingual content to be available in SharePoint list and you need write the text in all the required languages. Instead, Microsoft Flow can be leveraged for translating the content on Office 365 SharePoint for the required languages with the help of Translator service.

There are several ways available for implementing the above scenario. The best possible solution is explained in this post.

Note: This article only focuses on translating content present on SharePoint lists. For enabling multilingual feature for whole portal, you can refer to the Microsoft article here.


Microsoft Flow


Microsoft Flow provides a connector called as Microsoft Translator, which in turn is part of Azure Cognitive Service. Microsoft Translator is cloud-based automatic translation (machine translation) service supporting more than 60 languages. Currently translator connector is available in preview mode for Microsoft Flow.


Office 365 SharePoint Content Translation with Microsoft Flow and Translator


The solution explained here includes the implementation of workflows using Microsoft Flows. Whenever a new item is created in the SharePoint, Flow is used for translating the text instantly and update the same item with the translated content.

Note: In case if you are going to implement this solution for SharePoint on-premise content, you need to implement the same using the gateways.

The other possible solutions can be 
  • Writing webhooks/event receivers for sending and receiving back the content to/from Azure Cognitive Services. 
  • Timers periodically checking for the content, translating and saving back on the lists.
  • Azure Logic App to implement the above workflow, using Microsoft Translator Text API for translating the content.

Let us explore the steps involved.

In the Office 365 SharePoint online portal, make sure the list is created with two fields for storing the content. One field for Source text (English) and other field for storing the target text (Assuming German).

Open the Microsoft Flow portal (https://flow.microsoft.com), and follow the below steps. 
  • Navigate to My Flows tab and click on Create From blank option.
  • Trigger needs to be selected. Select “When an item is created” trigger option under SharePoint connectors.
  • Select Signin to create a connection, if connection is not already added. Provide the Office 365 credentials of the required, on which above SharePoint list is present.
  • Provide the Site Address and select the list name from the auto populated dropdown.
  • In the new step, go for Add an Action option. Search for Microsoft Translator – Translate Text Action.
    • In the text box, select the source language field of the SharePoint list. The source language column is the field where user will provide their input.
    • In the Target language box, select the target language for translating the above source field content.
  • In the new step, go for Add an Action option. Select SharePoint – Update Item action under SharePoint connectors.
    • Provide the site address and list name, where the translated content needs to be stored. In my case, it is same as the source list. ID will be populated on dynamic content, since it is the source list ID.
    • In the target field column, add the translated text option available on dynamic content.
  • Provide flow name, save the flow and click on Done.

The following picture depicts the above steps on Microsoft Flow.



Go to respective list on the Office 365 SharePoint list. Add new item and provide the source language text on source field, then click on Save. After few seconds, you will see the target column content populated using the Microsoft Translator.