machineTranslation.translate.promise(options)
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 |
|
Synchronous Version |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
100 |
Module |
|
Since |
2025.1 |
Syntax
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