machineTranslation.Document
The content in this help topic pertains to SuiteScript 2.1.
Object Description |
A document returned from machineTranslation.createDocument(options) or machineTranslation.translate(options). A document represents text that you send to or receive from the translation service. This object includes properties for the document ID (Document.id), document language (Document.language), and document text (Document.text). When you create a document for translation using machineTranslation.createDocument(options), you can specify the source language of the document. If you don't specify the source language, the translation service detects the language automatically.
Note:
For best translation results, each document should contain text in a single language only. The translation service supports documents that use multiple languages, but the accuracy and completeness of the resulting translation may vary. When passing documents to machineTranslation.translate(options) for translation, keep the following considerations in mind:
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Module |
|
Methods and Properties |
|
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.'
});
const translationResults = machineTranslation.translate({
documents: [myDocument1, myDocument2],
targetLanguage: machineTranslation.Language.CZECH
});
...
// Add additional code