aws-sdk-translate 1.56.0 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1af55cf07d4a4e6d5d9472ba80d7fa87c606054ae572c878ae381a73e7a7221d
4
- data.tar.gz: 0127bb0677f18f501a7dde813b9bb3c2effecf1dd9a3bdea3ddcaa565a072d97
3
+ metadata.gz: 6d336de918e1553f7a01066209ec93d7c037f147f710e0fcc99cb0a2f2697299
4
+ data.tar.gz: c5144d615f11903bea13ddd44cf8d90d1898fd82b7efea270f41d2e832215bc6
5
5
  SHA512:
6
- metadata.gz: c929bb0bdb6c7ab0e0b9dfa62e2a1e9319dcb29a2e1ab81685f4a8a9cf0681cd47ae965a49458e43efbc76fdbd9bc94dd41240e1322e81ba28738269f1bf6d6f
7
- data.tar.gz: e64f6f44c6c6983cc1c869e90bd04d02af6fcbeb7d4303dd11f6b71238c4f05b9078e153dc417f5920815dbc34ac60592530ddb3f99b93a6d0c96ccc2e8aadac
6
+ metadata.gz: f7e4080eb6d78b69d2e11b9d61e11bfe341f190a3c39c0dbe39b105c456d4868378a997de7c4b570bbd01122ef765e08e4e61d41830a58706690c5f9d9b1e2c5
7
+ data.tar.gz: ceb96088e0a7814157747914c984d30e057f107abc7ea21bedbb91e872e45b47239bbd217bbe8c0184349e963143fba5aa019167c7ebe729651a02e0fad1051c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.58.0 (2023-08-16)
5
+ ------------------
6
+
7
+ * Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
8
+
9
+ * Issue - Preserve Document encoding in `TranslateDocument` for text documents (#2897).
10
+
11
+ 1.57.0 (2023-07-18)
12
+ ------------------
13
+
14
+ * Feature - Added DOCX word document support to TranslateDocument API
15
+
4
16
  1.56.0 (2023-07-11)
5
17
  ------------------
6
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.56.0
1
+ 1.58.0
@@ -33,6 +33,7 @@ require 'aws-sdk-core/plugins/defaults_mode.rb'
33
33
  require 'aws-sdk-core/plugins/recursion_detection.rb'
34
34
  require 'aws-sdk-core/plugins/sign.rb'
35
35
  require 'aws-sdk-core/plugins/protocols/json_rpc.rb'
36
+ require 'aws-sdk-translate/plugins/translate_document_encoding.rb'
36
37
 
37
38
  Aws::Plugins::GlobalConfiguration.add_identifier(:translate)
38
39
 
@@ -83,6 +84,7 @@ module Aws::Translate
83
84
  add_plugin(Aws::Plugins::RecursionDetection)
84
85
  add_plugin(Aws::Plugins::Sign)
85
86
  add_plugin(Aws::Plugins::Protocols::JsonRpc)
87
+ add_plugin(Aws::Translate::Plugins::TranslateDocumentEncoding)
86
88
  add_plugin(Aws::Translate::Plugins::Endpoints)
87
89
 
88
90
  # @overload initialize(options)
@@ -1622,7 +1624,7 @@ module Aws::Translate
1622
1624
  params: params,
1623
1625
  config: config)
1624
1626
  context[:gem_name] = 'aws-sdk-translate'
1625
- context[:gem_version] = '1.56.0'
1627
+ context[:gem_version] = '1.58.0'
1626
1628
  Seahorse::Client::Request.new(handlers, context)
1627
1629
  end
1628
1630
 
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aws::Translate
4
+ module Plugins
5
+ # @api private
6
+ # The translated_documented returned by the translate_document api is modeled
7
+ # as a blob, since it may contain binary data (eg: word doc). However,
8
+ # when the input document is text (eg: text/plain or text/html) the encoding
9
+ # should be preserved.
10
+ class TranslateDocumentEncoding < Seahorse::Client::Plugin
11
+ class Handler < Seahorse::Client::Handler
12
+ def call(context)
13
+ # detect encoding
14
+ document = context.params[:document]
15
+ encoding =
16
+ if document[:content_type].start_with?('text/') && document[:content].is_a?(String)
17
+ document[:content].encoding
18
+ end
19
+ resp = @handler.call(context)
20
+ if encoding
21
+ resp.translated_document.content = resp.translated_document.content.force_encoding(encoding)
22
+ end
23
+ resp
24
+ end
25
+ end
26
+ def add_handlers(handlers, _config)
27
+ handlers.add(Handler, step: :initialize, operations: [:translate_document])
28
+ end
29
+ end
30
+ end
31
+ end
@@ -241,11 +241,14 @@ module Aws::Translate
241
241
  # Describes the format of the document. You can specify one of the
242
242
  # following:
243
243
  #
244
- # * text/html - The input data consists of HTML content. Amazon
244
+ # * `text/html` - The input data consists of HTML content. Amazon
245
245
  # Translate translates only the text in the HTML element.
246
246
  #
247
- # * text/plain - The input data consists of unformatted text. Amazon
247
+ # * `text/plain` - The input data consists of unformatted text. Amazon
248
248
  # Translate translates every character in the content.
249
+ #
250
+ # * `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
251
+ # - The input data consists of a Word document (.docx).
249
252
  # @return [String]
250
253
  #
251
254
  # @see http://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Document AWS API Documentation
@@ -52,6 +52,6 @@ require_relative 'aws-sdk-translate/customizations'
52
52
  # @!group service
53
53
  module Aws::Translate
54
54
 
55
- GEM_VERSION = '1.56.0'
55
+ GEM_VERSION = '1.58.0'
56
56
 
57
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.0
4
+ version: 1.58.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-11 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -64,6 +64,7 @@ files:
64
64
  - lib/aws-sdk-translate/endpoints.rb
65
65
  - lib/aws-sdk-translate/errors.rb
66
66
  - lib/aws-sdk-translate/plugins/endpoints.rb
67
+ - lib/aws-sdk-translate/plugins/translate_document_encoding.rb
67
68
  - lib/aws-sdk-translate/resource.rb
68
69
  - lib/aws-sdk-translate/types.rb
69
70
  homepage: https://github.com/aws/aws-sdk-ruby