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

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

Overview

The request message for synchronous translation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ TranslateTextRequest

Returns a new instance of TranslateTextRequest.



1190
1191
1192
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1190

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. The max length of this field is 1024. Use BatchTranslateText for larger text. Corresponds to the JSON property contents

Returns:

  • (Array<String>)


1140
1141
1142
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1140

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



1146
1147
1148
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1146

def glossary_config
  @glossary_config
end

#labelsHash<String,String>

Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter. See https://cloud.google.com/translate/docs/labels for more information. Corresponds to the JSON property labels

Returns:

  • (Hash<String,String>)


1156
1157
1158
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1156

def labels
  @labels
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)


1162
1163
1164
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1162

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-number-or-id/ locations/location-id/models/model-id`- General (built-in) models: projects/project-number-or-id/locations/location-id/models/general/nmt, For global (non-regionalized) requests, uselocation-idglobal. For example,projects/project-number-or-id/locations/global/models/general/nmt. If not provided, the default Google model (NMT) will be used Corresponds to the JSON propertymodel`

Returns:

  • (String)


1173
1174
1175
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1173

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)


1182
1183
1184
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1182

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)


1188
1189
1190
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1188

def target_language_code
  @target_language_code
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1195
1196
1197
1198
1199
1200
1201
1202
1203
# File 'lib/google/apis/translate_v3beta1/classes.rb', line 1195

def update!(**args)
  @contents = args[:contents] if args.key?(:contents)
  @glossary_config = args[:glossary_config] if args.key?(:glossary_config)
  @labels = args[:labels] if args.key?(:labels)
  @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