machineTranslation.translate.promise(options)

Note:

The content in this help topic pertains to SuiteScript 2.1.

Method Description

Asynchronously translates the provided documents into the specified language.

Note:

The parameters and errors thrown for this method are the same as those for machineTranslation.translate(options). For more information about promises, see Promise Object.

Returns

Promise Object

Synchronous Version

machineTranslation.translate(options)

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

100

Module

N/machineTranslation Module

Since

2025.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/machineTranslation Module Script Samples.

            // Add additional code
...

const myDocument1 = machineTranslation.createDocument({
    id: 'myDoc1',
    text: 'This is a document to be translated.'
});

const myDocument2 = machineTranslation.createDocument({
    id: 'myDoc2',
    text: 'This is another document to be translated.'
});

machineTranslation.translate.promise({
    documents: [myDocument1, myDocument2],
    targetLanguage: machineTranslation.Language.CZECH
}).then(function(result) {
    log.debug(result)
}).catch(function(reason) {
    log.debug(reason)
});

...
// Add additional code 

          

Related Topics

General Notices