Amazon Translate
Developer Guide

Translating Text Using the AWS SDK for Python (Boto)

The following example demonstrates using the TranslateText operation in Python. To run it, you must first install Amazon Translate via the AWS CLI. For instructions, see Step 2: Set Up the AWS Command Line Interface (AWS CLI).

import boto3 translate = boto3.client(service_name='translate', region_name='region', use_ssl=True) result = translate.translate_text(Text="Hello, World", SourceLanguageCode="en", TargetLanguageCode="de") print('TranslatedText: ' + result.get('TranslatedText')) print('SourceLanguageCode: ' + result.get('SourceLanguageCode')) print('TargetLanguageCode: ' + result.get('TargetLanguageCode'))

You can change the source and target languages as long as the language pair selected is supported by Amazon Translate in the correct combination. For more information, see Supported Language Pairs