Amazon Translate - Cloud Based Translation Service

Amazon Translate is a cloud based translation service that can currently (2017) translate documents in 7 languages - English, Arabic, Chinese, French, German, Portuguese and Spanish. The translation service uses machine learning to provide high-quality translation on demand.

The translate service can be used to build multilingual applications. For example, an application can be built that converts audio from Chinese to English in a train or build a chat platform where the user writes in one of the seven languages and it gets converted to English for the company and the response from the company gets converted to the desired language for the user.

The translate service can be combined with Comprehend service that could be used to translate text from Chinese or Arabic to English and then to identify the entities from the text.

Below is an example of how the translate service can be used from within Lambda using NodeJS.


        var AWS = require('aws-sdk');
        var translate = new AWS.Translate();
        
        
        exports.handler = (event, context, callback) => {
        
            var params = {
                Text: event.inputText,
                SourceLanguageCode: event.SourceLanguageCode,
                TargetLanguageCode: event.TargetLanguageCode
            };
        
        
            translate.translateText(params, function(err, data) {
                if (err) {
                    console.log(err, err.stack);
                }
                if (data) {
                    console.log(data.TranslatedText);
                }
            });
        };             
                    
    

In the above example, the text, SourceLanguageCode and TargetLanguageCode is supplied or detected and the translateText function is used to convert text to the desired language.

Note that the service is currently (2017) in preview in certain regions only.