Amazon Web Services Feed
Amazon Translate now enables you to mark content to not get translated
While performing machine translations, you may have situations where you wish to preserve specific sections of text from being translated, such as names, unique identifiers, or codes. We at the Amazon Translate team are excited to announce a tag modifications that allows you to specify what text should not be translated. This feature is available in both the real-time TranslateText
API and asynchronous batch TextTranslation
API. You can tag segments of text that you don’t want to translate in an HTML element. In this post, we walk through the step-by-step method to use this feature.
Using the translate-text operation in Command Line Interface
The following example shows you how to use the translate-text operation from the command line. This example is formatted for Unix, Linux, and macOS. For Windows, replace the backslash () Unix continuation character at the end of each line with a caret (^). At the command line, enter the following code:
You can specify any type of HTML element to do so, for example, paragraph <p>
, text section <span>
, or block section <div>
. When you run the command, you get the following output:
Using the span tag in Amazon Translate Console
In this example, we translate the following text from French to English:
Musée du Louvre, c’est ainsi que vous dites Musée du Louvre en français.
You don’t want to translate the first instance of “Musée du Louvre,” but you do want to translate the second instance to “Louvre Museum.” You can tag the first instance using a simple span tag:
The following screenshot shows the output on the Amazon Translate console.
The following screenshot shows the output translated to Arabic.
Conclusion
In this post, we showed you how to tag and specify text that should not be translated. For more information, see the Amazon Translate Developer Guide and Amazon Translate resources. If you’re new to Amazon Translate, try it out using our Free Tier, which offers 2 million characters per month for free for the first 12 months, starting from your first translation request.
About the Author
Watson G. Srivathsan is the Sr. Product Manager for Amazon Translate, AWS’s natural language processing service. On weekends you will find him exploring the outdoors in the Pacific Northwest.