AWS Machine Learning Blog
Use Amazon Translate to create multilingual content on WordPress sites
At the beginning of this year, we launched an Amazon Polly plugin for WordPress with the help of our partner, WP Engine. This plugin enabled creators/bloggers who publish their posts or sites using WordPress to easily add Text-to-Speech capabilities and convert their web content into high-quality audio formats. Since then, we’ve improved the plugin by introducing many new features that you requested, including support for the pronunciation lexicon, which you can use to customize the pronunciation of words read by Amazon Polly.
Today we are happy to announce the release of the second version of the plugin, which includes a machine translation feature. Providing multilingual content represents a massive opportunity for many site owners. Although English is the dominant language of the web, native English speakers are a mere 26% of the total online audience. Outside of the Anglosphere, multilingual environments are the norm. The new version of the Amazon Polly plugin for WordPress brings native integration with Amazon Translate, a neural machine translation service from the AWS machine learning portfolio. Using the updated plugin, creators and writers can automatically translate posts and sites to different languages.
Let’s see how you can use this new machine translation functionality!
You can find the plugin in the official plugin library for WordPress. If you’re using WordPress already, simply look for “Amazon Polly for WordPress” in your Plugins tab and install it.
We added a new Amazon Translate configuration section to the plugin settings page. With this new feature, you can easily translate posts into other languages with just a few clicks.
In this section (screenshot follows), you can enable translation functionality and specify some additional configurations to be used by the plugin:
- Show transcript – This option lets users see the translation of your content in other languages. If you don’t select it, the translation will be only be available in the audio version.
- Source language – Specify the language that is your source content. Currently, we support following languages: English, Spanish, German, French, and Portuguese. Other languages will be supported in the future.
- Source language label – This is the label for the source language that will be shown on your blog.
- Translation label – Specify a message for your users to let them know that they can listen/read your post in other languages.
- Target languages – Specify the other languages into which you want to translate your post. You will also specify the Amazon Polly voice which will be used to convert content into audio later.
This configuration is easy, and it doesn’t require any technical skills. Now let’s publish a blog post with this new translation functionality.
The process to publish new posts remains the same, simply provide the content and click the Publish button. At this step, the post won’t be translated into other languages, it will just publish the audio version in the source language of the text.
In the following screenshot, underneath the post there is a new Translate button in the Amazon Polly section. After you publish your post (you need to do it first), you will be able to click the Translate button, which will then convert your post into the languages which you have specified in settings page.
In the following screenshot, underneath the post there is a new Translate button in the Amazon Polly section. After you publish your post (you need to do it first), you will be able to click the Translate button, which will then convert your post into the languages which you have specified in settings page.
The speed of translating your post will depend on the size of your post and number of languages you have specified. After the translation is ready, open the blog and you can view how the content is being displayed.
In the following screenshot, above the text, you can see two elements. The first element is a translation section, which shows a list of languages that we specified earlier on the plugin settings page. The second element is a player that allows the user to listen the audio version of our post (in this example it plays the English version). The user can now click those languages to see text and listen to the content translated to the chosen language. Let’s choose the Spanish version (Español) and see the plugin in action.
As you can see from the screenshot, the view has changed. Because on the plugin settings page we selected the Show transcript option, the user is able to view the translated content of the post. In addition, the content was also translated into an audio version of the selected language. By clicking the player, the user will be able to listen audio version of this post in Spanish.
The following diagram presents a high-level overview of the interactions between WordPress and AWS services. When you click the Translate button, the plugin’s logic iterates through the languages that you specified on the settings page, and then it performs three actions. First, the content is sent to the Amazon Translate service for translation. Then, the newly translated content is sent to Amazon Polly, and a new audio version of the post is synthesized in the new language. By default, audio files are stored locally on disk on the web server. If you need to scale, you can integrate with Amazon S3 cloud storage and the CloudFront content delivery network.
We hope that you will get a lot of use out of this upgrade of the plugin. Please share your suggestions in the comments section. Your feedback is important to us as we continue to improve the plugin.
About the Author
Tomasz Stachlewski is a Solutions Architect at AWS, where he helps companies of all sizes (from startups to enterprises) in their cloud journey. He is a big believer in innovative technology, such as serverless architecture, which allows companies to accelerate their digital transformation.