Document.text

Note:

The content in this help topic pertains to SuiteScript 2.1.

Property Description

The text of the document.

When passing a document to machineTranslation.translate(options), this property represents the text to be translated. The maximum length of this property is 5,000 characters.

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 receiving a document from the translation service as part of a machineTranslation.Response object, this property represents the translated text.

Type

string

Supported Script Types

Server scripts

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

Module

N/machineTranslation Module

Parent Object

machineTranslation.Document

Sibling Object Members

Document Object Members

Since

2025.1

Errors

Error Code

Thrown If

READ_ONLY

Setting the property is attempted.

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 myDocument = machineTranslation.createDocument({
    id: 'myDoc',
    text: 'This is a document to be translated.'
});

const translationResults = machineTranslation.translate({
    documents: [myDocument],
    targetLanguage: machineTranslation.Language.CZECH
});

const docText = translationResults.results[0].text;

...
// Add additional code 

          

General Notices