Class Translation (2.7.0) 
  
  
  
   
  
    
  
  
    
    
    
    
  Version 2.7.0keyboard_arrow_down  
  
 
    
    
    
      
  
  
  
    
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 
  
  GLOSSARY_CONFIG_FIELD_NUMBER 
  
    
public   static   final   int   GLOSSARY_CONFIG_FIELD_NUMBER  
  Field Value 
  
  MODEL_FIELD_NUMBER 
  
    
public   static   final   int   MODEL_FIELD_NUMBER  
  Field Value 
  
  TRANSLATED_TEXT_FIELD_NUMBER 
  
    
public   static   final   int   TRANSLATED_TEXT_FIELD_NUMBER  
  Field Value 
  
  Static Methods
   
  getDefaultInstance() 
  
    
public   static   Translation   getDefaultInstance ()  
  Returns 
  
  getDescriptor() 
  
    
public   static   final   Descriptors . Descriptor   getDescriptor ()  
  Returns 
  
  newBuilder() 
  
    
public   static   Translation . Builder   newBuilder ()  
  Returns 
  
  newBuilder(Translation prototype) 
  
    
public   static   Translation . Builder   newBuilder ( Translation   prototype )  
  Parameter 
  
  Returns 
  
  
    
public   static   Translation   parseDelimitedFrom ( InputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   Translation   parseDelimitedFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(byte[] data) 
  
    
public   static   Translation   parseFrom ( byte []   data )  
  Parameter 
  
    
      
        Name Description  
      
        data byte [] 
     
  
  Returns 
  
  Exceptions 
  
  parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( byte []   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteString data) 
  
    
public   static   Translation   parseFrom ( ByteString   data )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( ByteString   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   Translation   parseFrom ( CodedInputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   Translation   parseFrom ( CodedInputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   Translation   parseFrom ( InputStream   input )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  
    
public   static   Translation   parseFrom ( InputStream   input ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteBuffer data) 
  
    
public   static   Translation   parseFrom ( ByteBuffer   data )  
  Parameter 
  
  Returns 
  
  Exceptions 
  
  parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) 
  
    
public   static   Translation   parseFrom ( ByteBuffer   data ,   ExtensionRegistryLite   extensionRegistry )  
  Parameters 
  
  Returns 
  
  Exceptions 
  
  parser() 
  
    
public   static   Parser<Translation>   parser ()  
  Returns 
  
  Methods
   
  equals(Object obj) 
  
    
public   boolean   equals ( Object   obj )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  getDefaultInstanceForType() 
  
    
public   Translation   getDefaultInstanceForType ()  
  Returns 
  
  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 
  
    
      
        Type Description  
      
        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 
  
    
      
        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;
Returns 
  
  getGlossaryConfigOrBuilder() 
  
    
public   TranslateTextGlossaryConfigOrBuilder   getGlossaryConfigOrBuilder ()  
   The glossary_config used for this translation.
 .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
Returns 
  
  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 
  
  getParserForType() 
  
    
public   Parser<Translation>   getParserForType ()  
  Returns 
  
  Overrides 
  
  getSerializedSize() 
  
    
public   int   getSerializedSize ()  
  Returns 
  
  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.
 
     
  
  getUnknownFields() 
  
    
public   final   UnknownFieldSet   getUnknownFields ()  
  Returns 
  
  Overrides 
  
  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 
  
  Overrides 
  
  internalGetFieldAccessorTable() 
  
    
protected   GeneratedMessageV3 . FieldAccessorTable   internalGetFieldAccessorTable ()  
  Returns 
  
  Overrides 
  
  isInitialized() 
  
    
public   final   boolean   isInitialized ()  
  Returns 
  
  Overrides 
  
  newBuilderForType() 
  
    
public   Translation . Builder   newBuilderForType ()  
  Returns 
  
  newBuilderForType(GeneratedMessageV3.BuilderParent parent) 
  
    
protected   Translation . Builder   newBuilderForType ( GeneratedMessageV3 . BuilderParent   parent )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  newInstance(GeneratedMessageV3.UnusedPrivateParameter unused) 
  
    
protected   Object   newInstance ( GeneratedMessageV3 . UnusedPrivateParameter   unused )  
  Parameter 
  
  Returns 
  
  Overrides 
  
  toBuilder() 
  
    
public   Translation . Builder   toBuilder ()  
  Returns 
  
  writeTo(CodedOutputStream output) 
  
    
public   void   writeTo ( CodedOutputStream   output )  
  Parameter 
  
  Overrides 
  
  Exceptions 
  
 
     
    
  
  
  
     
  
    
    
      
       
    
    
  
  
 
  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."],[],[]]