Class: Google::Apis::TranslateV3beta1::TranslateTextRequest

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/translate_v3beta1/classes.rb,
generated/google/apis/translate_v3beta1/representations.rb,
generated/google/apis/translate_v3beta1/representations.rb

Overview

The request message for synchronous translation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ TranslateTextRequest

Returns a new instance of TranslateTextRequest



788
789
790
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 788

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#contentsArray<String>

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. Use BatchTranslateText for larger text. Corresponds to the JSON property contents

Returns:

  • (Array<String>)


744
745
746
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 744

def contents
  @contents
end

#glossary_configGoogle::Apis::TranslateV3beta1::TranslateTextGlossaryConfig

Configures which glossary should be used for a specific target language, and defines options for applying that glossary. Corresponds to the JSON property glossaryConfig



750
751
752
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 750

def glossary_config
  @glossary_config
end

#mime_typeString

Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html". Corresponds to the JSON property mimeType

Returns:

  • (String)


756
757
758
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 756

def mime_type
  @mime_type
end

#modelString

Optional. The model type requested for this translation. The format depends on model type:

  • AutoML Translation models: projects/project-id/locations/location-id/models/model-id``
  • General (built-in) models: projects/project-id/locations/location-id/models/general/nmt, projects/project-id/locations/location-id/models/general/base For global (non-regionalized) requests, use location-id global. For example, projects/project-id/locations/global/models/general/nmt. If missing, the system decides which google base model to use. Corresponds to the JSON property model

Returns:

  • (String)


771
772
773
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 771

def model
  @model
end

#source_language_codeString

Optional. The BCP-47 language code of the input text if known, for example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If the source language isn't specified, the API attempts to identify the source language automatically and returns the source language within the response. Corresponds to the JSON property sourceLanguageCode

Returns:

  • (String)


780
781
782
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 780

def source_language_code
  @source_language_code
end

#target_language_codeString

Required. The BCP-47 language code to use for translation of the input text, set to one of the language codes listed in Language Support. Corresponds to the JSON property targetLanguageCode

Returns:

  • (String)


786
787
788
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 786

def target_language_code
  @target_language_code
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



793
794
795
796
797
798
799
800
# File 'generated/google/apis/translate_v3beta1/classes.rb', line 793

def update!(**args)
  @contents = args[:contents] if args.key?(:contents)
  @glossary_config = args[:glossary_config] if args.key?(:glossary_config)
  @mime_type = args[:mime_type] if args.key?(:mime_type)
  @model = args[:model] if args.key?(:model)
  @source_language_code = args[:source_language_code] if args.key?(:source_language_code)
  @target_language_code = args[:target_language_code] if args.key?(:target_language_code)
end