Class Translation (2.3.5)

public final class Translation extends GeneratedMessageV3 implements TranslationOrBuilder

A single translation response.

Protobuf type google.cloud.translation.v3.Translation

Static Fields

DETECTED_LANGUAGE_CODE_FIELD_NUMBER

public static final int DETECTED_LANGUAGE_CODE_FIELD_NUMBER
Field Value
TypeDescription
int

GLOSSARY_CONFIG_FIELD_NUMBER

public static final int GLOSSARY_CONFIG_FIELD_NUMBER
Field Value
TypeDescription
int

MODEL_FIELD_NUMBER

public static final int MODEL_FIELD_NUMBER
Field Value
TypeDescription
int

TRANSLATED_TEXT_FIELD_NUMBER

public static final int TRANSLATED_TEXT_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static Translation getDefaultInstance()
Returns
TypeDescription
Translation

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

newBuilder()

public static Translation.Builder newBuilder()
Returns
TypeDescription
Translation.Builder

newBuilder(Translation prototype)

public static Translation.Builder newBuilder(Translation prototype)
Parameter
NameDescription
prototypeTranslation
Returns
TypeDescription
Translation.Builder

parseDelimitedFrom(InputStream input)

public static Translation parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Translation parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static Translation parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static Translation parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static Translation parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static Translation parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static Translation parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static Translation parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static Translation parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static Translation parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static Translation parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static Translation parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
Translation
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<Translation> parser()
Returns
TypeDescription
Parser<Translation>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getDefaultInstanceForType()

public Translation getDefaultInstanceForType()
Returns
TypeDescription
Translation

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.

string detected_language_code = 4;

Returns
TypeDescription
String

The detectedLanguageCode.

getDetectedLanguageCodeBytes()

public ByteString getDetectedLanguageCodeBytes()

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.

string detected_language_code = 4;

Returns
TypeDescription
ByteString

The bytes for detectedLanguageCode.

getGlossaryConfig()

public TranslateTextGlossaryConfig getGlossaryConfig()

The glossary_config used for this translation.

.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;

Returns
TypeDescription
TranslateTextGlossaryConfig

The glossaryConfig.

getGlossaryConfigOrBuilder()

public TranslateTextGlossaryConfigOrBuilder getGlossaryConfigOrBuilder()

The glossary_config used for this translation.

.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;

Returns
TypeDescription
TranslateTextGlossaryConfigOrBuilder

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.

string model = 2;

Returns
TypeDescription
String

The model.

getModelBytes()

public ByteString getModelBytes()

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.

string model = 2;

Returns
TypeDescription
ByteString

The bytes for model.

getParserForType()

public Parser<Translation> getParserForType()
Returns
TypeDescription
Parser<Translation>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

getTranslatedText()

public String getTranslatedText()

Text translated into the target language. If an error occurs during translation, this field might be excluded from the response.

string translated_text = 1;

Returns
TypeDescription
String

The translatedText.

getTranslatedTextBytes()

public ByteString getTranslatedTextBytes()

Text translated into the target language. If an error occurs during translation, this field might be excluded from the response.

string translated_text = 1;

Returns
TypeDescription
ByteString

The bytes for translatedText.

getUnknownFields()

public final UnknownFieldSet getUnknownFields()
Returns
TypeDescription
UnknownFieldSet
Overrides

hasGlossaryConfig()

public boolean hasGlossaryConfig()

The glossary_config used for this translation.

.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;

Returns
TypeDescription
boolean

Whether the glossaryConfig field is set.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

public Translation.Builder newBuilderForType()
Returns
TypeDescription
Translation.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected Translation.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
Translation.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

public Translation.Builder toBuilder()
Returns
TypeDescription
Translation.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides Exceptions
TypeDescription
IOException