aws-sdk-translate 1.57.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-translate/client.rb +3 -1
- data/lib/aws-sdk-translate/plugins/translate_document_encoding.rb +31 -0
- data/lib/aws-sdk-translate.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d336de918e1553f7a01066209ec93d7c037f147f710e0fcc99cb0a2f2697299
|
4
|
+
data.tar.gz: c5144d615f11903bea13ddd44cf8d90d1898fd82b7efea270f41d2e832215bc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e4080eb6d78b69d2e11b9d61e11bfe341f190a3c39c0dbe39b105c456d4868378a997de7c4b570bbd01122ef765e08e4e61d41830a58706690c5f9d9b1e2c5
|
7
|
+
data.tar.gz: ceb96088e0a7814157747914c984d30e057f107abc7ea21bedbb91e872e45b47239bbd217bbe8c0184349e963143fba5aa019167c7ebe729651a02e0fad1051c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
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
|
+
|
4
11
|
1.57.0 (2023-07-18)
|
5
12
|
------------------
|
6
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
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.
|
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
|
data/lib/aws-sdk-translate.rb
CHANGED
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.
|
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-
|
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
|