Class: Google::Apis::TranslateV2::TranslateTextRequest

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

Overview

The main translation request message for the Cloud Translation API.

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



170
171
172
# File 'generated/google/apis/translate_v2/classes.rb', line 170

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

Instance Attribute Details

#formatString

The format of the source text, in either HTML (default) or plain-text. A value of "html" indicates HTML and a value of "text" indicates plain-text. Corresponds to the JSON property format

Returns:

  • (String)


148
149
150
# File 'generated/google/apis/translate_v2/classes.rb', line 148

def format
  @format
end

#modelString

The model type requested for this translation. Valid values are listed in public documentation. Corresponds to the JSON property model

Returns:

  • (String)


168
169
170
# File 'generated/google/apis/translate_v2/classes.rb', line 168

def model
  @model
end

#qArray<String>

The input text to translate. Repeat this parameter to perform translation operations on multiple text inputs. Corresponds to the JSON property q

Returns:

  • (Array<String>)


154
155
156
# File 'generated/google/apis/translate_v2/classes.rb', line 154

def q
  @q
end

#sourceString

The language of the source text, set to one of the language codes listed in Language Support. If the source language is not specified, the API will attempt to identify the source language automatically and return it within the response. Corresponds to the JSON property source

Returns:

  • (String)


162
163
164
# File 'generated/google/apis/translate_v2/classes.rb', line 162

def source
  @source
end

#targetString

The language to use for translation of the input text, set to one of the language codes listed in Language Support. Corresponds to the JSON property target

Returns:

  • (String)


142
143
144
# File 'generated/google/apis/translate_v2/classes.rb', line 142

def target
  @target
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



175
176
177
178
179
180
181
# File 'generated/google/apis/translate_v2/classes.rb', line 175

def update!(**args)
  @target = args[:target] if args.key?(:target)
  @format = args[:format] if args.key?(:format)
  @q = args[:q] if args.key?(:q)
  @source = args[:source] if args.key?(:source)
  @model = args[:model] if args.key?(:model)
end