class Google::Apis::TranslateV3::TranslateTextRequest

The request message for synchronous translation.

Attributes

contents[RW]

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` @return [Array<String>]

glossary_config[RW]

Configures which glossary should be used for a specific target language, and defines options for applying that glossary. Corresponds to the JSON property `glossaryConfig` @return [Google::Apis::TranslateV3::TranslateTextGlossaryConfig]

labels[RW]

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 cloud.google.com/translate/docs/advanced/ labels for more information. Corresponds to the JSON property `labels` @return [Hash<String,String>]

mime_type[RW]

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` @return [String]

model[RW]

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, use `location-id` `global`. 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` @return [String]

source_language_code[RW]

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` @return [String]

target_language_code[RW]

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` @return [String]

Public Class Methods

new(**args) click to toggle source
# File lib/google/apis/translate_v3/classes.rb, line 807
def initialize(**args)
   update!(**args)
end

Public Instance Methods

update!(**args) click to toggle source

Update properties of this object

# File lib/google/apis/translate_v3/classes.rb, line 812
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