AWS.Translate reference
DescribeTextTranslationJob
Section titled “DescribeTextTranslationJob”Source:
src/AWS/Translate/DescribeTextTranslationJob.ts
Runtime binding for translate:DescribeTextTranslationJob — get the
properties of an asynchronous batch translation job (status, language
pair, input/output locations, document counts).
DescribeTextTranslationJob: Batch Translation Jobs
Section titled “DescribeTextTranslationJob: Batch Translation Jobs”// initconst describeJob = yield* AWS.Translate.DescribeTextTranslationJob();
// runtimeconst result = yield* describeJob({ JobId: job.JobId! });// result.TextTranslationJobProperties?.JobStatusGetParallelData
Section titled “GetParallelData”Source:
src/AWS/Translate/GetParallelData.ts
Runtime binding for translate:GetParallelData — retrieve a parallel
data resource’s properties and a presigned download location for its
input file.
GetParallelData: Reading Parallel Data
Section titled “GetParallelData: Reading Parallel Data”// initconst getParallelData = yield* AWS.Translate.GetParallelData();
// runtimeconst result = yield* getParallelData({ Name: examples.parallelDataName });// result.ParallelDataProperties?.Status === "ACTIVE"GetTerminology
Section titled “GetTerminology”Source:
src/AWS/Translate/GetTerminology.ts
Runtime binding for translate:GetTerminology — retrieve a custom
terminology’s properties and a presigned download location for its
term-pair file.
GetTerminology: Reading Terminologies
Section titled “GetTerminology: Reading Terminologies”// initconst getTerminology = yield* AWS.Translate.GetTerminology();
// runtimeconst result = yield* getTerminology({ Name: glossary.terminologyName });// result.TerminologyProperties?.TermCount// result.TerminologyDataLocation?.Location — presigned download URLListLanguages
Section titled “ListLanguages”Source:
src/AWS/Translate/ListLanguages.ts
Runtime binding for translate:ListLanguages — list the languages
(RFC-5646 codes and display names) Amazon Translate supports.
ListLanguages: Discovering Languages
Section titled “ListLanguages: Discovering Languages”// initconst listLanguages = yield* AWS.Translate.ListLanguages();
// runtimeconst result = yield* listLanguages({ MaxResults: 100 });// result.Languages -> [{ LanguageCode: "es", LanguageName: "Spanish" }, …]ListParallelData
Section titled “ListParallelData”Source:
src/AWS/Translate/ListParallelData.ts
Runtime binding for translate:ListParallelData — list the parallel data
resources in the account and region.
ListParallelData: Reading Parallel Data
Section titled “ListParallelData: Reading Parallel Data”// initconst listParallelData = yield* AWS.Translate.ListParallelData();
// runtimeconst result = yield* listParallelData({ MaxResults: 50 });// result.ParallelDataPropertiesList -> [{ Name, Arn, Status, … }, …]ListTerminologies
Section titled “ListTerminologies”Source:
src/AWS/Translate/ListTerminologies.ts
Runtime binding for translate:ListTerminologies — list the custom
terminologies in the account and region.
ListTerminologies: Reading Terminologies
Section titled “ListTerminologies: Reading Terminologies”// initconst listTerminologies = yield* AWS.Translate.ListTerminologies();
// runtimeconst result = yield* listTerminologies({ MaxResults: 50 });// result.TerminologyPropertiesList -> [{ Name, Arn, TermCount, … }, …]ListTextTranslationJobs
Section titled “ListTextTranslationJobs”Source:
src/AWS/Translate/ListTextTranslationJobs.ts
Runtime binding for translate:ListTextTranslationJobs — list the batch
translation jobs submitted in the account and region, optionally filtered
by name, status, or submission time.
ListTextTranslationJobs: Batch Translation Jobs
Section titled “ListTextTranslationJobs: Batch Translation Jobs”// initconst listJobs = yield* AWS.Translate.ListTextTranslationJobs();
// runtimeconst result = yield* listJobs({ Filter: { JobStatus: "IN_PROGRESS" }, MaxResults: 25,});// result.TextTranslationJobPropertiesList -> [{ JobId, JobStatus, … }, …]ParallelData
Section titled “ParallelData”Source:
src/AWS/Translate/ParallelData.ts
Amazon Translate parallel data — segment-aligned translation examples
imported from S3 that steer the style, tone, and word choice of batch
translation jobs (Active Custom Translation). The import is asynchronous:
the resource waits for the parallel data to become ACTIVE.
ParallelData: Managing Parallel Data
Section titled “ParallelData: Managing Parallel Data”Import parallel data from S3
const examples = yield* AWS.Translate.ParallelData("StyleExamples", { s3Uri: "s3://my-bucket/style-examples.csv", format: "CSV",});Use parallel data in a batch translation job
const startJob = yield* AWS.Translate.StartTextTranslationJob(dataAccessRole);yield* startJob({ InputDataConfig: { S3Uri: "s3://my-bucket/input/", ContentType: "text/plain" }, OutputDataConfig: { S3Uri: "s3://my-bucket/output/" }, SourceLanguageCode: "en", TargetLanguageCodes: ["es"], ParallelDataNames: [examples.parallelDataName],});StartTextTranslationJob
Section titled “StartTextTranslationJob”Source:
src/AWS/Translate/StartTextTranslationJob.ts
Runtime binding for translate:StartTextTranslationJob — start an
asynchronous batch translation job over a collection of documents in S3.
The binding is constructed with the data-access role (the IAM role
Amazon Translate assumes to read the input documents and write results;
its trust policy must allow translate.amazonaws.com). The role’s ARN is
injected as DataAccessRoleArn on every runtime request and the host is
granted iam:PassRole on it alongside
translate:StartTextTranslationJob (which has no resource-level IAM).
Track the job with DescribeTextTranslationJob and stop it with
StopTextTranslationJob.
StartTextTranslationJob: Batch Translation Jobs
Section titled “StartTextTranslationJob: Batch Translation Jobs”// deploy time — bind the Translate data-access roleconst startJob = yield* AWS.Translate.StartTextTranslationJob(dataAccessRole);
// runtimeconst job = yield* startJob({ InputDataConfig: { S3Uri: "s3://my-bucket/input/", ContentType: "text/plain" }, OutputDataConfig: { S3Uri: "s3://my-bucket/output/" }, SourceLanguageCode: "en", TargetLanguageCodes: ["es"],});// job.JobId, job.JobStatus === "SUBMITTED"StopTextTranslationJob
Section titled “StopTextTranslationJob”Source:
src/AWS/Translate/StopTextTranslationJob.ts
Runtime binding for translate:StopTextTranslationJob — stop an
asynchronous batch translation job that is in progress. An IN_PROGRESS
job is marked STOP_REQUESTED and later STOPPED; a job that completes
first ends COMPLETED.
StopTextTranslationJob: Batch Translation Jobs
Section titled “StopTextTranslationJob: Batch Translation Jobs”// initconst stopJob = yield* AWS.Translate.StopTextTranslationJob();
// runtimeconst result = yield* stopJob({ JobId: job.JobId! });// result.JobStatus === "STOP_REQUESTED"Terminology
Section titled “Terminology”Source:
src/AWS/Translate/Terminology.ts
An Amazon Translate custom terminology — a glossary of term pairs (CSV,
TMX, or TSV) that pins how specific words and phrases (brand names,
product names, domain jargon) are translated. Reference it by name from
TranslateText, TranslateDocument, or batch translation jobs.
Terminology: Managing Terminologies
Section titled “Terminology: Managing Terminologies”Import a CSV terminology
const glossary = yield* AWS.Translate.Terminology("BrandGlossary", { file: ["en,es", "Alchemy,Alquimia"].join("\n"), format: "CSV",});Translate text with the terminology applied
const translateText = yield* AWS.Translate.TranslateText();const result = yield* translateText({ Text: "Alchemy deploys infrastructure.", SourceLanguageCode: "en", TargetLanguageCode: "es", TerminologyNames: [glossary.terminologyName],});TranslateDocument
Section titled “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>.
TranslateDocument: Translating Documents
Section titled “TranslateDocument: 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!"TranslateText
Section titled “TranslateText”Source:
src/AWS/Translate/TranslateText.ts
Runtime binding for translate:TranslateText — translate text between
a source and a target language.
Translate is a pure pay-per-call service with no resource to manage:
the binding takes no arguments and grants the function
translate:TranslateText (the action has no resource-level IAM).
Language codes follow RFC 5646 (en, es, de, …); pass auto as
the source to let Translate detect the language (this additionally
calls Comprehend under the hood).
TranslateText: Translating Text
Section titled “TranslateText: Translating Text”// initconst translateText = yield* AWS.Translate.TranslateText();
// runtimeconst result = yield* translateText({ Text: "Hello, world!", SourceLanguageCode: "en", TargetLanguageCode: "es",});// result.TranslatedText === "¡Hola, mundo!"