Class: Google::Apis::TranslateV3::TranslateTextRequest
- Inherits:
-
Object
- Object
- Google::Apis::TranslateV3::TranslateTextRequest
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/translate_v3/classes.rb,
lib/google/apis/translate_v3/representations.rb,
lib/google/apis/translate_v3/representations.rb
Overview
The request message for synchronous translation.
Instance Attribute Summary collapse
-
#contents ⇒ Array<String>
Required.
-
#glossary_config ⇒ Google::Apis::TranslateV3::TranslateTextGlossaryConfig
Configures which glossary is used for a specific target language and defines options for applying that glossary.
-
#labels ⇒ Hash<String,String>
Optional.
-
#mime_type ⇒ String
Optional.
-
#model ⇒ String
Optional.
-
#source_language_code ⇒ String
Optional.
-
#target_language_code ⇒ String
Required.
-
#transliteration_config ⇒ Google::Apis::TranslateV3::TransliterationConfig
Configures transliteration feature on top of translation.
Instance Method Summary collapse
-
#initialize(**args) ⇒ TranslateTextRequest
constructor
A new instance of TranslateTextRequest.
-
#update!(**args) ⇒ Object
Update properties of this object.
Constructor Details
#initialize(**args) ⇒ TranslateTextRequest
Returns a new instance of TranslateTextRequest.
2332 2333 2334 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2332 def initialize(**args) update!(**args) end |
Instance Attribute Details
#contents ⇒ Array<String>
Required. The content of the input in string format. We recommend the total
content be less than 30,000 codepoints. The max length of this field is 1024.
Use BatchTranslateText for larger text.
Corresponds to the JSON property contents
2275 2276 2277 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2275 def contents @contents end |
#glossary_config ⇒ Google::Apis::TranslateV3::TranslateTextGlossaryConfig
Configures which glossary is used for a specific target language and defines
options for applying that glossary.
Corresponds to the JSON property glossaryConfig
2281 2282 2283 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2281 def glossary_config @glossary_config end |
#labels ⇒ Hash<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/advanced/
labels for more information.
Corresponds to the JSON property labels
2291 2292 2293 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2291 def labels @labels end |
#mime_type ⇒ String
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
2297 2298 2299 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2297 def mime_type @mime_type end |
#model ⇒ String
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, -
Translation LLM models:
projects/project-number-or-id
/locations/location-
id
/models/general/translation-llm, For global (non-regionalized) requests,
use
location-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 property
model`
2310 2311 2312 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2310 def model @model end |
#source_language_code ⇒ String
Optional. The ISO-639 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
2319 2320 2321 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2319 def source_language_code @source_language_code end |
#target_language_code ⇒ String
Required. The ISO-639 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
2325 2326 2327 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2325 def target_language_code @target_language_code end |
#transliteration_config ⇒ Google::Apis::TranslateV3::TransliterationConfig
Configures transliteration feature on top of translation.
Corresponds to the JSON property transliterationConfig
2330 2331 2332 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2330 def transliteration_config @transliteration_config end |
Instance Method Details
#update!(**args) ⇒ Object
Update properties of this object
2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 |
# File 'lib/google/apis/translate_v3/classes.rb', line 2337 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) @transliteration_config = args[:transliteration_config] if args.key?(:transliteration_config) end |