AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Translates the input document from the source language to the target language. This synchronous operation supports text, HTML, or Word documents as the input document. TranslateDocument supports translations from English to any supported language, and from any supported language to English. Therefore, specify either the source language code or the target language code as “en” (English).

If you set the Formality parameter, the request will fail if the target language does not support formality. For a list of target languages that support formality, see Setting formality.

Note:

This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginTranslateDocument and EndTranslateDocument.

Namespace: Amazon.Translate
Assembly: AWSSDK.Translate.dll
Version: 3.x.y.z

Syntax

C#
public abstract Task<TranslateDocumentResponse> TranslateDocumentAsync(
         TranslateDocumentRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.Translate.Model.TranslateDocumentRequest

Container for the necessary parameters to execute the TranslateDocument service method.

cancellationToken
Type: System.Threading.CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Return Value


The response from the TranslateDocument service method, as returned by Translate.

Exceptions

ExceptionCondition
InternalServerException An internal server error occurred. Retry your request.
InvalidRequestException The request that you made is not valid. Check your request to determine why it's not valid and then retry the request.
LimitExceededException The specified limit has been exceeded. Review your request and retry it with a quantity below the stated limit.
ResourceNotFoundException The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.
ServiceUnavailableException The Amazon Translate service is temporarily unavailable. Wait a bit and then retry your request.
TooManyRequestsException You have made too many requests within a short period of time. Wait for a short time and then try your request again.
UnsupportedLanguagePairException Amazon Translate does not support translation from the language of the source text into the requested target language. For more information, see Supported languages.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer

See Also