Use a web browser plugin to quickly translate text with Amazon Translate
Web browsers can be a single pane of glass for organizations to interact with their information—all of the tools can be viewed and accessed on one screen so that users don’t have to switch between applications and interfaces. For example, a customer call center might have several different applications to see customer reviews, social media feeds, and customer data. Each one of these applications are interacted with through web browsers. If the information is in a language that the user doesn’t speak, however, a separate application often needs to be pulled up to translate text. Web browser plugins enable customization of this user experience.
Amazon Translate is a neural machine translation service that delivers fast, high-quality, affordable, and customizable language translation. Neural machine translation is a form of language translation automation that uses deep learning models to deliver more accurate and more natural sounding translation than traditional statistical and rule-based translation algorithms. As of writing this post, Amazon Translate supports 75 languages and 5,550 language pairs. For the latest list, see the Amazon Translate Developer Guide.
With the Amazon Translate web browser plugin, you can simply click a button and have an entire web page translated to whatever language you prefer. This browser plugin works in Chromium-based and Firefox-based browsers.
This post shows how you can use a browser plugin to quickly translate web pages with neural translation with Amazon Translate.
Overview of solution
To use the plugin, install it into a browser on your workstation. To translate a web page, activate the plugin, which authenticates to Amazon Translate using AWS Identity and Access Management (IAM), sends the text of the page you wish to translate to the Amazon Translate service, and returns the translated text to be displayed in the web browser. The browser plugin also enables caching of translated pages. When caching is enabled, translations requested for a webpage are cached to your local machine by their language pairs. Caching improves the speed of the translation of the page and reduces the number of requests made to the Amazon Translate service, potentially saving time and money.
To install and use the plugin, complete the following steps:
- Set up an IAM user and credentials.
- Install the browser plugin.
- Configure the browser plugin.
- Use the plugin to translate text.
The browser plugin is available on GitHub.
For this walkthrough, you should have the following prerequisites:
- An AWS account
- A compatible web browser
- The privileges to create IAM users to authenticate to Amazon Translate
For more information about how Amazon Translate interacts with IAM, see Identity and Access Management for Amazon Translate.
Set up an IAM user and credentials
The browser plugin needs to be configured with credentials to access Amazon Translate. IAM is configured with an AWS-managed policy called
TranslateReadOnly. This policy allows API calls to Amazon Translate. To set up a read-only IAM user, complete the following steps:
- On the IAM console, choose Users in the navigation pane under Access management.
- Choose Add users.
- For User name, enter
- Choose Next: Permissions.
- To add permissions, choose Attach existing policies directly and choose the policy
- Choose Next: Tags.
- Optionally, give the user a tag, and choose Next: Review.
- Review the new role and choose Create user.
- Choose Download .csv and save the credentials locally.
Although these credentials only provide the most restrictive access to Amazon Translate, you should take extreme care with these credentials so they’re not shared with unintended entities. AWS or Amazon will not be responsible if our customers share their credentials.
Install the browser plugin
The web browser plugin is supported in all Chromium-based browsers. To install the plugin in Chrome, complete the following steps:
- Download the extension.zip file from GitHub.
- Unzip the file on your local machine.
- In Chrome, choose the extensions icon.
- Choose Manage Extensions.
- Toggle Developer mode on.
- Choose Load Unpacked and point to the extension folder that you just unzipped.
Configure the plugin
To configure the plugin, complete the following steps:
- In your browser, choose the extensions toolbar and choose Amazon Translate, the newly installed plugin.
You can choose the pin icon for easier access later.
- Choose Extension Settings.
- For AWS Region, enter the Region closest to you.
- For AWS Access Key ID, enter the AWS access key from the spreadsheet you downloaded.
- For AWS Secret Access Key, enter the secret access key from the spreadsheet.
- Select the check box to enable caching.
- Choose Save Settings.
Use the plugin with Amazon Translate
Now the plugin is ready to be used.
- To get started, open a web page in a browser to be translated. For this post, we use the landing page for Amazon Translate in German.
- Open the browser plugin and choose Amazon Translate in the browser extension list as you did earlier.
- For the source language, choose Auto for Amazon Translate to use automatic language detection, and choose your target language.
- Choose Translate..
The plugin sends the text to Amazon Translate and translates the page contents to English.
Amazon Translate is priced at $15 per million characters prorated by number of characters ($0.000015 per character).
You also get 2 million characters per month for 12 months for free, starting from the date on which you create your first translation request. For more information, see Amazon Translate pricing.
The Amazon Translate landing page we translated has about 8,000 characters, making the translation cost about $0.12. With the caching feature enabled, subsequent calls to translate the page for the language pair use the local cached copy, and don’t require calls to Amazon Translate.
Amazon Translate provides neural network translation for 75 languages and 5,550 language pairs. You can integrate Amazon Translate into a browser plugin, to seamlessly integrate translation into an application workflow. We look forward to hearing how using this plugin helps accelerate your translation workloads! Learn more about Amazon Translate by on the Amazon Translate Developer Guide, or AWS blog.
About the Authors
Andrew Stacy is a Front-end Developer with AWS Professional Services. Andrew enjoys creating delightful user experiences for customers through UI/UX development and design. When off the clock, Andrew enjoys playing with his kids, writing code, trying craft beverages, or building things around the house.
Ron Weinstein is a Solutions Architect specializing in Artificial Intelligence and Machine Learning in AWS Public Sector. Ron loves working with his customers on how AI/ML can accelerate and transform their business. When not at work, Ron likes the outdoors and spending time with his family.