SingleDocumentTranslationClient.DocumentTranslate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DocumentTranslate(String, DocumentTranslateContent, String, String, Nullable<Boolean>, CancellationToken) |
Submit a single document translation request to the Document Translation service. |
DocumentTranslate(String, RequestContent, String, String, String, Nullable<Boolean>, RequestContext) |
[Protocol Method] Submit a single document translation request to the Document Translation service
|
DocumentTranslate(String, DocumentTranslateContent, String, String, Nullable<Boolean>, CancellationToken)
Submit a single document translation request to the Document Translation service.
public virtual Azure.Response<BinaryData> DocumentTranslate (string targetLanguage, Azure.AI.Translation.Document.DocumentTranslateContent documentTranslateContent, string sourceLanguage = default, string category = default, bool? allowFallback = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DocumentTranslate : string * Azure.AI.Translation.Document.DocumentTranslateContent * string * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.Response<BinaryData>
override this.DocumentTranslate : string * Azure.AI.Translation.Document.DocumentTranslateContent * string * string * Nullable<bool> * System.Threading.CancellationToken -> Azure.Response<BinaryData>
Public Overridable Function DocumentTranslate (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 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.
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
DocumentTranslate(String, RequestContent, String, String, String, Nullable<Boolean>, RequestContext)
[Protocol Method] Submit a single document translation request to the Document Translation service
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler DocumentTranslate(String, DocumentTranslateContent, String, String, Nullable<Boolean>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response DocumentTranslate (string targetLanguage, Azure.Core.RequestContent content, string contentType, string sourceLanguage = default, string category = default, bool? allowFallback = default, Azure.RequestContext context = default);
abstract member DocumentTranslate : string * Azure.Core.RequestContent * string * string * string * Nullable<bool> * Azure.RequestContext -> Azure.Response
override this.DocumentTranslate : string * Azure.Core.RequestContent * string * string * string * Nullable<bool> * Azure.RequestContext -> Azure.Response
Public Overridable Function DocumentTranslate (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 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.
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
Azure SDK for .NET