Language Translation Using Amazon Translate

By Saira Shaik | Posted April 3, 2019


In this tutorial, we show you how to translate a Host’s speech into several different languages using Amazon Translate. You can translate the text to one of 15 languages (specified in the table shown belowin this tutorial. You can also specify the voice used by the Host by changing the voice ID. Instead of swapping out and translating large chunks of text, this exercise will show you how to translate text by changing a language code. Behind the scenes, this uses the Amazon Polly API to synthesize the speech from the text you provide.

Note: Amazon Translate supports only the latest version of the AWS Javascript SDK. Be sure you have the latest version of the SDK loaded in the Amazon Sumerian AWS Configuration component.

You’ll learn about:

  • AWS configuration
  • Amazon Cognito identity pool IDs
  • The Speech component
  • How to play dynamic speech during runtime
  • Integrating with Amazon Translate

Prerequisites

Before you begin, you should have completed the following tasks and tutorials:

Step 1: Create a New Scene and Add Cognito Identity Pool ID

In this step, we create an Amazon Cognito identity pool ID (Amazon Cognito ID), create a scene, and add the Amazon Cognito ID to connect our scene to other AWS services. More specifically, we will create an AWS CloudFormation stack that has an Amazon Cognito Federated Identity pool that contains permissions for using functionality in your scene. We will also attach necessary IAM policies for this exercise.

Configure with AWS by Creating an AWS CloudFormation Stack

  1. Create an AWS CloudFormation stack using the Amazon Cognito Setup Using AWS CloudFormation tutorial. Once the stack is created, navigate to Output and make a note of the Cognito Identity Pool ID. We’ll insert this later in the Sumerian scene.

  2. Staying in the AWS Management Console, now open the IAM console.

  3. Choose Roles, and then find the role you just created.

  4. Open the new unauthenticated role. Choose Attach Policy, and then search for and add the AmazonTranscribeReadOnlyAccess policy and the TranslateFullAccess policy.

Create a New Sumerian Scene

  1. Navigate to the Sumerian Dashboard. From the Dashboard, create a new, empty scene. Use any name you like.

  2. Click the scene’s name, Language Translation. This is the root entity, located in the Entities panel on the left side of the interface.

  3. In the Inspector panel on the right, provide your Cognito Identity Pool ID in the AWS configuration section.

  4. Make sure the AWS SDK for JavaScript has been updated with the latest version of the SDK.

Step 2: Set Up the Scene

In this step, we add a Sumerian Host and an empty entity.

  1. Choose Import Asset at the top of the canvas.

  2. Choose any Host from the asset library. Click Add in the lower-right corner. I will be using Cristine.

  3. Navigate to the Assets panel. Under the Host asset pack, find the Host entity (in my scene, I will see Cristine next to the hexagon icon), and drag the entity into your scene. The screen should look like the following: