Class: Aws::Translate::Plugins::TranslateDocumentEncoding::Handler Private

Inherits:
Seahorse::Client::Handler
  • Object
show all
Defined in:
lib/aws-sdk-translate/plugins/translate_document_encoding.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Method Summary collapse

Instance Method Details

#call(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/aws-sdk-translate/plugins/translate_document_encoding.rb', line 13

def call(context)
  # detect encoding
  document = context.params[:document]
  encoding =
    if document[:content_type].start_with?('text/') && document[:content].is_a?(String)
      document[:content].encoding
    end
  resp = @handler.call(context)
  resp.translated_document.content = resp.translated_document.content.force_encoding(encoding) if encoding
  resp
end