v4

latestSwagger 2.02026-07-1371563.0 KB
Translate

Translates text into one or more languages.

post/translate

Query parameters

api-versionstring required

Version of the API requested by the client. Value must be 3.0.

fromstring

Specifies the language of the input text. Find which languages are available to translate from by using the languages method. If the from parameter is not specified, automatic language detection is applied to determine the source language.

tostring[] required

Specifies the language of the output text. Find which languages are available to translate to by using the languages method. For example, use to=de to translate to German. It's possible to translate to multiple languages simultaneously by repeating the to parameter in the query string. For example, use to=de&to=it to translate to German and Italian in the same request.

textType'plain' | 'html'

Defines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, complete HTML element. Possible values are plain (default) or html

categorystring

A string specifying the category (domain) of the translation. This parameter retrieves translations from a customized system built with Custom Translator. Default value is general.

profanityAction'NoAction' | 'Marked' | 'Deleted'

Specifies how profanities should be treated in translations. Possible values are: NoAction (default), Marked or Deleted.

Handling Profanity

Normally the Translator service will retain profanity that is present in the source in the translation. The degree of profanity and the context that makes words profane differ between cultures, and as a result the degree of profanity in the target language may be amplified or reduced.

If you want to avoid getting profanity in the translation, regardless of the presence of profanity in the source text, you can use the profanity filtering option. The option allows you to choose whether you want to see profanity deleted, whether you want to mark profanities with appropriate tags (giving you the option to add your own post-processing), or you want no action taken. The accepted values of ProfanityAction are Deleted, Marked and NoAction (default).

ProfanityActionAction
NoActionThis is the default behavior. Profanity will pass from source to target.
Example Source (Japanese)- 彼はジャッカスです。
Example Translation (English)- He is a jackass.
DeletedProfane words will be removed from the output without replacement.
Example Source (Japanese)- 彼はジャッカスです。
Example Translation (English)- He is a.
MarkedProfane words are replaced by a marker in the output. The marker depends on the ProfanityMarker parameter.
For ProfanityMarker=Asterisk, profane words are replaced with ***
Example Source (Japanese)- 彼はジャッカスです。
Example Translation (English)- He is a ***.
For ProfanityMarker=Tag, profane words are surrounded by XML tags <profanity> and </profanity>
Example Source (Japanese)- 彼はジャッカスです。
Example Translation (English)- He is a <profanity>jackass</profanity>.
profanityMarkerstring

Specifies how profanities should be marked in translations. Possible values are- Asterisk (default) or Tag.

includeAlignmentboolean

Specifies whether to include alignment projection from source text to translated text. Possible values are- true or false (default).

includeSentenceLengthboolean

Specifies whether to include sentence boundaries for the input text and the translated text. Possible values are- true or false (default).

suggestedFromstring

Specifies a fallback language if the language of the input text can't be identified. Language auto-detection is applied when the from parameter is omitted. If detection fails, the suggestedFrom language will be assumed.

fromScriptstring

Specifies the script of the input text. Supported scripts are available from the languages method

toScriptstring[]

Specifies the script of the translated text. Supported scripts are available from the languages method

Headers

X-ClientTraceIdstring

A client-generated GUID to uniquely identify the request. Note that you can omit this header if you include the trace ID in the query string using a query parameter named ClientTraceId.

Request body

textstring

Example request

[
  {
    "text": "I would really like to drive your car."
  }
]

Response

Success