Class Translation (2.40.0) 
  
  
  
   
  
    
  
  
    
    
    
    
  Version 2.40.0keyboard_arrow_down  
  
 
    
    
    
      
  
  
  
    
public   final   class  Translation   extends   GeneratedMessageV3   implements   TranslationOrBuilder  
   A single translation response.
 Protobuf type google.cloud.translation.v3.Translation
    Inherited Members 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT) 
    
    
      com.google.protobuf.GeneratedMessageV3.<ListT>makeMutableCopy(ListT,int) 
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.<T>emptyList(java.lang.Class<T>) 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      com.google.protobuf.GeneratedMessageV3.internalGetMapFieldReflection(int) 
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
   
  Static Fields
   
  DETECTED_LANGUAGE_CODE_FIELD_NUMBER 
  
    
public   static   final   int   DETECTED_LANGUAGE_CODE_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  GLOSSARY_CONFIG_FIELD_NUMBER 
  
    
public   static   final   int   GLOSSARY_CONFIG_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  MODEL_FIELD_NUMBER 
  
    
public   static   final   int   MODEL_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  TRANSLATED_TEXT_FIELD_NUMBER 
  
    
public   static   final   int   TRANSLATED_TEXT_FIELD_NUMBER  
  
    
      
        Field Value  
      
        Type Description  
      
        int  
     
  
  Static Methods
   
  getDefaultInstance() 
  
    
public   static   Translation   getDefaultInstance ()  
  
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
  
  newBuilder() 
  
    
public   static   Translation . Builder   newBuilder ()  
  
  newBuilder(Translation prototype) 
  
    
public   static   Translation . Builder   newBuilder ( Translation   prototype )  
  
  
  
    
public   static   Translation   parseDelimitedFrom ( InputStream   input )  
  
  
  
  
    
public   static   Translation   parseDelimitedFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(byte[] data) 
  
    
public   static   Translation   parseFrom ( byte []   data )  
  
    
      
        Parameter  
      
        Name Description  
      
        databyte [] 
     
  
  
  
  parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( byte []   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(ByteString data) 
  
    
public   static   Translation   parseFrom ( ByteString   data )  
  
  
  
  parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( ByteString   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  
    
public   static   Translation   parseFrom ( CodedInputStream   input )  
  
  
  
  
    
public   static   Translation   parseFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  
    
public   static   Translation   parseFrom ( InputStream   input )  
  
  
  
  
    
public   static   Translation   parseFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parseFrom(ByteBuffer data) 
  
    
public   static   Translation   parseFrom ( ByteBuffer   data )  
  
  
  
  parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( ByteBuffer   data ,   ExtensionRegistryLite   extensionRegistry )  
  
  
  
  parser() 
  
    
public   static   Parser<Translation>   parser ()  
  
  Methods
   
  equals(Object obj) 
  
    
public   boolean   equals ( Object   obj )  
  
    
      
        Parameter  
      
        Name Description  
      
        objObject  
     
  
  
  Overrides 
  
  getDefaultInstanceForType() 
  
    
public   Translation   getDefaultInstanceForType ()  
  
  getDetectedLanguageCode() 
  
    
public   String   getDetectedLanguageCode ()  
   The ISO-639 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  
      
        Type Description  
      
        String The detectedLanguageCode.
 
     
  
  getDetectedLanguageCodeBytes() 
  
    
public   ByteString   getDetectedLanguageCodeBytes ()  
   The ISO-639 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  
      
        Type Description  
      
        ByteString The bytes for detectedLanguageCode.
 
     
  
  getGlossaryConfig() 
  
    
public   TranslateTextGlossaryConfig   getGlossaryConfig ()  
   The glossary_config used for this translation.
 .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
getGlossaryConfigOrBuilder() 
  
    
public   TranslateTextGlossaryConfigOrBuilder   getGlossaryConfigOrBuilder ()  
   The glossary_config used for this translation.
 .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
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  
      
        Type Description  
      
        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  
      
        Type Description  
      
        ByteString The bytes for model.
 
     
  
  getParserForType() 
  
    
public   Parser<Translation>   getParserForType ()  
  
  Overrides 
  
  getSerializedSize() 
  
    
public   int   getSerializedSize ()  
  
    
      
        Returns  
      
        Type Description  
      
        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  
      
        Type Description  
      
        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  
      
        Type Description  
      
        ByteString The bytes for translatedText.
 
     
  
  hasGlossaryConfig() 
  
    
public   boolean   hasGlossaryConfig ()  
   The glossary_config used for this translation.
 .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
    
      
        Returns  
      
        Type Description  
      
        boolean Whether the glossaryConfig field is set.
 
     
  
  hashCode() 
  
  
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  Overrides 
  
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
  
  Overrides 
  
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
  
  Overrides 
  
  newBuilderForType() 
  
    
public   Translation . Builder   newBuilderForType ()  
  
  newBuilderForType(GeneratedMessageV3.BuilderParent parent) 
  
    
protected   Translation . Builder   newBuilderForType ( GeneratedMessageV3 . BuilderParent   parent )  
  
  
  Overrides 
  
  newInstance(GeneratedMessageV3.UnusedPrivateParameter unused) 
  
    
protected   Object   newInstance ( GeneratedMessageV3 . UnusedPrivateParameter   unused )  
  
  
    
      
        Returns  
      
        Type Description  
      
        Object  
     
  
  Overrides 
  
  toBuilder() 
  
    
public   Translation . Builder   toBuilder ()  
  
  writeTo(CodedOutputStream output) 
  
    
public   void   writeTo ( CodedOutputStream   output )  
  
  Overrides 
  
  
 
     
    
  
  
  
     
  
    
    
      
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-29 UTC.
 
 
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-29 UTC."],[],[]]