Package com.google.cloud.translate
Class Translation
- java.lang.Object
-
- com.google.cloud.translate.Translation
-
- All Implemented Interfaces:
Serializable
public class Translation extends Object implements Serializable
Information about a translation. Objects of this class contain the translated text and the source language's code. The source language's code can be optionally specified by the user or automatically detected by the Google Translation service.- See Also:
- Translating Text, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getModel()
Returns the translation model used to translate the text.String
getSourceLanguage()
Returns the language code of the source text.String
getTranslatedText()
Returns the translated text.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getTranslatedText
public String getTranslatedText()
Returns the translated text.
-
getSourceLanguage
public String getSourceLanguage()
Returns the language code of the source text. If no source language was provided this value is the source language as detected by the Google Translation service.
-
getModel
public String getModel()
Returns the translation model used to translate the text. This value is only available if a result fromTranslate.TranslateOption.model(String)
was passed toTranslate.translate(List, Translate.TranslateOption...)
.Please note that you must be whitelisted to use the
Translate.TranslateOption.model(String)
option, otherwise translation will fail.
-
-