Share via


SingleDocumentTranslationClient.TranslateAsync Method

Definition

Overloads

TranslateAsync(String, DocumentTranslateContent, String, String, Nullable<Boolean>, CancellationToken)

Submit a single document translation request to the Document Translation service.

TranslateAsync(String, RequestContent, String, String, String, Nullable<Boolean>, RequestContext)

[Protocol Method] Submit a single document translation request to the Document Translation service

TranslateAsync(String, DocumentTranslateContent, String, String, Nullable<Boolean>, CancellationToken)

Source:
SingleDocumentTranslationClient.cs

Submit a single document translation request to the Document Translation service.

public virtual System.Threading.Tasks.Task<Azure.Response<BinaryData>> TranslateAsync (string targetLanguage, Azure.AI.Translation.Document.DocumentTranslateContent documentTranslateContent, string sourceLanguage = default, string category = default, bool? allowFallback = default, System.Threading.CancellationToken cancellationToken = default);
abstract member TranslateAsync : string * Azure.AI.Translation.Document.DocumentTranslateContent * string * string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<BinaryData>>
override this.TranslateAsync : string * Azure.AI.Translation.Document.DocumentTranslateContent * string * string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<BinaryData>>
Public Overridable Function TranslateAsync (targetLanguage As String, documentTranslateContent As DocumentTranslateContent, Optional sourceLanguage As String = Nothing, Optional category As String = Nothing, Optional allowFallback As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of BinaryData))

Parameters

targetLanguage
String

Specifies the language of the output document. The target language must be one of the supported languages included in the translation scope. For example if you want to translate the document in German language, then use targetLanguage=de

documentTranslateContent
DocumentTranslateContent

Document Translate Request Content.

sourceLanguage
String

Specifies source language of the input document. If this parameter isn't specified, automatic language detection is applied to determine the source language. For example if the source document is written in English, then use sourceLanguage=en

category
String

A string specifying the category (domain) of the translation. This parameter is used to get translations from a customized system built with Custom Translator. Add the Category ID from your Custom Translator project details to this parameter to use your deployed customized system. Default value is: general.

allowFallback
Nullable<Boolean>

Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. Possible values are: true (default) or false.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

targetLanguage or documentTranslateContent is null.

Remarks

Use this API to submit a single translation request to the Document Translation Service.

Applies to

TranslateAsync(String, RequestContent, String, String, String, Nullable<Boolean>, RequestContext)

Source:
SingleDocumentTranslationClient.cs

[Protocol Method] Submit a single document translation request to the Document Translation service

public virtual System.Threading.Tasks.Task<Azure.Response> TranslateAsync (string targetLanguage, Azure.Core.RequestContent content, string contentType, string sourceLanguage = default, string category = default, bool? allowFallback = default, Azure.RequestContext context = default);
abstract member TranslateAsync : string * Azure.Core.RequestContent * string * string * string * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.TranslateAsync : string * Azure.Core.RequestContent * string * string * string * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function TranslateAsync (targetLanguage As String, content As RequestContent, contentType As String, Optional sourceLanguage As String = Nothing, Optional category As String = Nothing, Optional allowFallback As Nullable(Of Boolean) = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

targetLanguage
String

Specifies the language of the output document. The target language must be one of the supported languages included in the translation scope. For example if you want to translate the document in German language, then use targetLanguage=de

content
RequestContent

The content to send as the body of the request.

contentType
String

Content Type as multipart/form-data. Allowed values: "multipart/form-data".

sourceLanguage
String

Specifies source language of the input document. If this parameter isn't specified, automatic language detection is applied to determine the source language. For example if the source document is written in English, then use sourceLanguage=en

category
String

A string specifying the category (domain) of the translation. This parameter is used to get translations from a customized system built with Custom Translator. Add the Category ID from your Custom Translator project details to this parameter to use your deployed customized system. Default value is: general.

allowFallback
Nullable<Boolean>

Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. Possible values are: true (default) or false.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

targetLanguage or content is null.

Service returned a non-success status code.

Applies to