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 input text from the source language to the target language. For a list of available languages and language codes, see Supported languages.

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 BeginTranslateText and EndTranslateText.

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

Syntax

C#
public abstract Task<TranslateTextResponse> TranslateTextAsync(
         TranslateTextRequest request,
         CancellationToken cancellationToken
)

Parameters

request
Type: Amazon.Translate.Model.TranslateTextRequest

Container for the necessary parameters to execute the TranslateText 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 TranslateText service method, as returned by Translate.

Exceptions

ExceptionCondition
DetectedLanguageLowConfidenceException The confidence that Amazon Comprehend accurately detected the source language is low. If a low confidence level is acceptable for your application, you can use the language in the exception to call Amazon Translate again. For more information, see the DetectDominantLanguage operation in the Amazon Comprehend Developer Guide.
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.
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.
TextSizeLimitExceededException The size of the text you submitted exceeds the size limit. Reduce the size of the text or use a smaller document 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 Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5

See Also