Package com.google.cloud.translate
Class Translate.TranslateOption
- java.lang.Object
-
- com.google.cloud.translate.Translate.TranslateOption
-
- All Implemented Interfaces:
Serializable
- Enclosing interface:
- Translate
public static class Translate.TranslateOption extends Object
Class for specifying translate options.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)static Translate.TranslateOptionformat(String format)Sets the format of the source text, in either HTML (default) or plain-text.inthashCode()static Translate.TranslateOptionmodel(String model)Sets the language translation model.static Translate.TranslateOptionsourceLanguage(String sourceLanguage)Returns an option for setting the source language.static Translate.TranslateOptiontargetLanguage(String targetLanguage)Returns an option for setting the target language.StringtoString()
-
-
-
Method Detail
-
sourceLanguage
public static Translate.TranslateOption sourceLanguage(String sourceLanguage)
Returns an option for setting the source language. If not provided, Google Translation will try to detect the language of the text to translate.- Parameters:
sourceLanguage- the source language code
-
targetLanguage
public static Translate.TranslateOption targetLanguage(String targetLanguage)
Returns an option for setting the target language. If this option is not provided, the value returned byTranslateOptions.getTargetLanguage()is used.- Parameters:
targetLanguage- the target language code
-
model
public static Translate.TranslateOption model(String model)
Sets the language translation model. You can use this parameter to take advantage of Neural Machine Translation. Possible values arebaseandnmt. Google Translation could use a different model to translate your text: useTranslation.getModel()to know which model was used for translation. Please note that you must be whitelisted to use this option, otherwise translation will fail.- Parameters:
model- the language translation model
-
format
public static Translate.TranslateOption format(String format)
Sets the format of the source text, in either HTML (default) or plain-text. A value ofhtmlindicates HTML and a value oftextindicates plain-text.- Parameters:
format- the format of the source text
-
-