TranslateDocument
Source:
src/AWS/Translate/TranslateDocument.ts
Runtime binding for translate:TranslateDocument — synchronously
translate a whole document (plain text, HTML, or Word) between a source
and a target language.
One of the two language codes must be en (English). The document
content and the translated result are sensitive blobs — the response’s
TranslatedDocument.Content decodes as Redacted<Uint8Array>.
Translating Documents
Section titled “Translating Documents”// initconst translateDocument = yield* AWS.Translate.TranslateDocument();
// runtimeconst result = yield* translateDocument({ Document: { Content: new TextEncoder().encode("Good morning!"), ContentType: "text/plain", }, SourceLanguageCode: "en", TargetLanguageCode: "es",});const bytes = Redacted.value(result.TranslatedDocument.Content as Redacted.Redacted<Uint8Array>);// new TextDecoder().decode(bytes) === "¡Buenos días!"