,

Document Translation in SharePoint Online Part 1

Posted by

Intro

A common ask is how to translate documents into other languages that are stored in SharePoint Online. This requirement fits several use cases across business segments. The quick answer is that you can do document translation for documents stored in SharePoint Online. For Example, I may want to upload a word document in English and translate it to Japanese and store that translated document back into SharePoint. In this blog, I’ll use Azure Translator Service, Azure Blog Storage Service, Power Automate, and SharePoint Online to build a solution that meets this requirement.

 

Basic Setup Requirements

The basic setup requirements include an Azure Subscription, Power Automate license, and an M365 Tenant. If you’re like me and simply want to test and learn, you can sign up for the Microsoft 365 Developer Program which will equip you with an Office 365 E3 Developer subscription good for 3 months. This comes with a nice sandbox that includes a sample M365 Tenant with appropriate license to build Power Automate flows with premium connectors. More information here: Set up a Microsoft 365 developer sandbox subscription | Microsoft Docs. This is a great start and after standing up your sandbox the last thing is to ensure you have Azure Subscription with an Azure Storage Account and Azure Translator Resource provisioned. I created a single Resource Group and have both resources provisioned: 


For Azure Translator Service, I enabled Managed Identity as this will register the resource with Azure Active Directory and use it to authorize to an Azure resource where it’s been granted access. This option is available when you first provision the Azure Translator resource or can be enabled after the service is provisioned by accessing the identity option from the blade.

In addition, I will also need to copy the subscription id from the Translator Service Overview page. This will be used by the Power Automate flow to call the endpoint securely. Without the subscription key, authorization will fail during the flow run.

 
For the Azure Storage Account, I accessed containers and created a container called azspostore.

To gain access to the Azure Storage Account, I’ll grant the translator resource the ‘Storage Blob Data Contributor’ role.  From the Storage Account navigation pane, I accessed the Access Control (IAM) option and added the role assignment.  It looks like:


For Power Automate
, I’ll need to setup a connection to Azure Blob Storage and a connection to SharePoint Online.  For example, within Power Automate/Data/Connections I have the following:

In subsequent blog post, I’ll walk through importing and configuring two flows that do the heavy lifting.  For more details, see the basic flow section.


For SharePoint
, I have a modern team site provisioned and created a document library called TranslateDocLib which will store the original documents.  The document library contains a folder called translated which is where translated documents will be dropped in.


Basic Flow

It’s important to logically construct the moving parts of this will work from start to finish.  From an end user perspective, they will place a document in a document library and that document will appear in a subfolder within the same document library translated into a different language.  More detailed steps are below:

  1. User uploads a document authored in English.
  2. Power Automate Flow 1 called “Translate-Now” picks up the document from SharePoint and place it in Azure Blob Store
  3. Power Automate Flow 1 (Translate-Now) calls into Azure Translation Service rest endpoint to perform a translation. 
  4. Translation Service receives inbound http call and translates the document and places it back into blob store.
  5. Power Automate Flow 2 triggers after new document is placed in destination container/folder and picks up the file and drops it in the SharePoint Online Document Library sub folder where translated documents go.


Note: For Step 4, the translate service knows where to retrieve the file and store a new translated file because the rest call from step 3 includes the source location where the document can be picked up and target location for new document are both included in the request.


Once you build out the nuts and bolts I describe above, you’re ready to proceed to part 2 where I’ll dive into importing and configuring two Power Automate flows that make this magic happen. 


Important Note: Part 2 is ready and available here: Document Translation in SharePoint Online Part 2 – Russ Maxwell

Thank You,

Russ Maxwell, Microsoft