You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Translate::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-translate/lib/aws-sdk-translate/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



152
153
154
# File 'gems/aws-sdk-translate/lib/aws-sdk-translate/client.rb', line 152

def initialize(*args)
  super
end

Instance Method Details

#translate_text(params = {}) ⇒ Types::TranslateTextResponse

Translates input text from the source language to the target language. You can translate between English (en) and one of the following languages, or between one of the following languages and English.

  • Arabic (ar)

  • Chinese (Simplified) (zh)

  • French (fr)

  • German (de)

  • Portuguese (pt)

  • Spanish (es)

Examples:

Request syntax with placeholder values


resp = client.translate_text({
  text: "BoundedLengthString", # required
  source_language_code: "LanguageCodeString", # required
  target_language_code: "LanguageCodeString", # required
})

Response structure


resp.translated_text #=> String
resp.source_language_code #=> String
resp.target_language_code #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :text (required, String)

    The text to translate.

  • :source_language_code (required, String)

    One of the supported language codes for the source text. If the TargetLanguageCode is not "en", the SourceLanguageCode must be "en".

  • :target_language_code (required, String)

    One of the supported language codes for the target text. If the SourceLanguageCode is not "en", the TargetLanguageCode must be "en".

Returns:

See Also:



211
212
213
214
# File 'gems/aws-sdk-translate/lib/aws-sdk-translate/client.rb', line 211

def translate_text(params = {}, options = {})
  req = build_request(:translate_text, params)
  req.send_request(options)
end