TranslateInputItem Class

  • java.lang.Object
    • com.azure.ai.translation.text.models.TranslateInputItem

Implements

public final class TranslateInputItem
implements JsonSerializable<TranslateInputItem>

Element containing the text for translation.

Constructor Summary

Constructor Description
TranslateInputItem(String text, List<TranslationTarget> translationTargets)

Creates an instance of TranslateInputItem class.

Method Summary

Modifier and Type Method and Description
static TranslateInputItem fromJson(JsonReader jsonReader)

Reads an instance of TranslateInputItem from the JsonReader.

String getLanguage()

Get the language property: Specifies the language of the input text.

String getScript()

Get the script property: Specifies the script of the input text.

String getText()

Get the text property: Text to translate.

TextType getTextType()

Get the textType property: Defines whether the text being translated is plain text or HTML text.

List<TranslationTarget> getTranslationTargets()

Get the translationTargets property: Translation target parameters.

TranslateInputItem setLanguage(String language)

Set the language property: Specifies the language of the input text.

TranslateInputItem setScript(String script)

Set the script property: Specifies the script of the input text.

TranslateInputItem setTextType(TextType textType)

Set the textType property: Defines whether the text being translated is plain text or HTML text.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

TranslateInputItem

public TranslateInputItem(String text, List<TranslationTarget> translationTargets)

Creates an instance of TranslateInputItem class.

Parameters:

text - the text value to set.
translationTargets - the translationTargets value to set.

Method Details

fromJson

public static TranslateInputItem fromJson(JsonReader jsonReader)

Reads an instance of TranslateInputItem from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of TranslateInputItem if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getLanguage

public String getLanguage()

Get the language property: Specifies the language of the input text. Find which languages are available to translate by looking up supported languages using the translation scope. If the language parameter isn't specified, automatic language detection is applied to determine the source language. You must use the language parameter rather than autodetection when using the dynamic dictionary feature. Note: the dynamic dictionary feature is case-sensitive.

Returns:

the language value.

getScript

public String getScript()

Get the script property: Specifies the script of the input text.

Returns:

the script value.

getText

public String getText()

Get the text property: Text to translate.

Returns:

the text value.

getTextType

public TextType getTextType()

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

Returns:

the textType value.

getTranslationTargets

public List<TranslationTarget> getTranslationTargets()

Get the translationTargets property: Translation target parameters.

Returns:

the translationTargets value.

setLanguage

public TranslateInputItem setLanguage(String language)

Set the language property: Specifies the language of the input text. Find which languages are available to translate by looking up supported languages using the translation scope. If the language parameter isn't specified, automatic language detection is applied to determine the source language. You must use the language parameter rather than autodetection when using the dynamic dictionary feature. Note: the dynamic dictionary feature is case-sensitive.

Parameters:

language - the language value to set.

Returns:

the TranslateInputItem object itself.

setScript

public TranslateInputItem setScript(String script)

Set the script property: Specifies the script of the input text.

Parameters:

script - the script value to set.

Returns:

the TranslateInputItem object itself.

setTextType

public TranslateInputItem setTextType(TextType textType)

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

Parameters:

textType - the textType value to set.

Returns:

the TranslateInputItem object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to