target.apidocs.com.google.api.services.translate.v3beta1.model.Translation.html Maven / Gradle / Ivy
Translation (Cloud Translation API v3beta1-rev20230210-2.0.0)
com.google.api.services.translate.v3beta1.model
Class Translation
- java.lang.Object
-
- java.util.AbstractMap<String,Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.json.GenericJson
-
- com.google.api.services.translate.v3beta1.model.Translation
-
public final class Translation
extends com.google.api.client.json.GenericJson
A single translation response.
This is the Java data model class that specifies how to parse/serialize into the JSON that is
transmitted over HTTP when working with the Cloud Translation API. For a detailed explanation
see:
https://developers.google.com/api-client-library/java/google-http-java-client/json
- Author:
- Google, Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
com.google.api.client.util.GenericData.Flags
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
-
Constructor Summary
Constructors
Constructor and Description
Translation()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
Translation
clone()
String
getDetectedLanguageCode()
The BCP-47 language code of source text in the initial request, detected automatically, if no
source language was passed within the initial request.
TranslateTextGlossaryConfig
getGlossaryConfig()
The `glossary_config` used for this translation.
String
getModel()
Only present when `model` is present in the request.
String
getTranslatedText()
Text translated into the target language.
Translation
set(String fieldName,
Object value)
Translation
setDetectedLanguageCode(String detectedLanguageCode)
The BCP-47 language code of source text in the initial request, detected automatically, if no
source language was passed within the initial request.
Translation
setGlossaryConfig(TranslateTextGlossaryConfig glossaryConfig)
The `glossary_config` used for this translation.
Translation
setModel(String model)
Only present when `model` is present in the request.
Translation
setTranslatedText(String translatedText)
Text translated into the target language.
-
Methods inherited from class com.google.api.client.json.GenericJson
getFactory, setFactory, toPrettyString, toString
-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
Method Detail
-
getDetectedLanguageCode
public String getDetectedLanguageCode()
The BCP-47 language code of source text in the initial request, detected automatically, if no
source language was passed within the initial request. If the source language was passed, auto-
detection of the language does not occur and this field is empty.
- Returns:
- value or
null
for none
-
setDetectedLanguageCode
public Translation setDetectedLanguageCode(String detectedLanguageCode)
The BCP-47 language code of source text in the initial request, detected automatically, if no
source language was passed within the initial request. If the source language was passed, auto-
detection of the language does not occur and this field is empty.
- Parameters:
detectedLanguageCode
- detectedLanguageCode or null
for none
-
getGlossaryConfig
public TranslateTextGlossaryConfig getGlossaryConfig()
The `glossary_config` used for this translation.
- Returns:
- value or
null
for none
-
setGlossaryConfig
public Translation setGlossaryConfig(TranslateTextGlossaryConfig glossaryConfig)
The `glossary_config` used for this translation.
- Parameters:
glossaryConfig
- glossaryConfig or null
for none
-
getModel
public String getModel()
Only present when `model` is present in the request. `model` here is normalized to have project
number. For example: If the `model` requested in TranslationTextRequest is `projects/{project-
id}/locations/{location-id}/models/general/nmt` then `model` here would be normalized to
`projects/{project-number}/locations/{location-id}/models/general/nmt`.
- Returns:
- value or
null
for none
-
setModel
public Translation setModel(String model)
Only present when `model` is present in the request. `model` here is normalized to have project
number. For example: If the `model` requested in TranslationTextRequest is `projects/{project-
id}/locations/{location-id}/models/general/nmt` then `model` here would be normalized to
`projects/{project-number}/locations/{location-id}/models/general/nmt`.
- Parameters:
model
- model or null
for none
-
getTranslatedText
public String getTranslatedText()
Text translated into the target language. If an error occurs during translation, this field
might be excluded from the response.
- Returns:
- value or
null
for none
-
setTranslatedText
public Translation setTranslatedText(String translatedText)
Text translated into the target language. If an error occurs during translation, this field
might be excluded from the response.
- Parameters:
translatedText
- translatedText or null
for none
-
set
public Translation set(String fieldName,
Object value)
- Overrides:
set
in class com.google.api.client.json.GenericJson
-
clone
public Translation clone()
- Overrides:
clone
in class com.google.api.client.json.GenericJson
Copyright © 2011–2023 Google. All rights reserved.