google-cloud-translate 0.22.1 → 0.22.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/README.md +4 -4
- data/lib/google-cloud-translate.rb +8 -8
- data/lib/google/cloud/translate.rb +17 -17
- data/lib/google/cloud/translate/api.rb +17 -17
- data/lib/google/cloud/translate/credentials.rb +1 -1
- data/lib/google/cloud/translate/detection.rb +2 -2
- data/lib/google/cloud/translate/language.rb +2 -2
- data/lib/google/cloud/translate/service.rb +1 -1
- data/lib/google/cloud/translate/translation.rb +5 -5
- data/lib/google/cloud/translate/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc02e5e77139872a34c39b397d3920f568b99c41
|
4
|
+
data.tar.gz: 8613621b2008e7fc43c29bc5282a7f1fcd466dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e446862a154edd1dafed4f8dac84f44f48da1769f115f460a806a7e347234a30207192cee743e33b484776fdf23f24aa3b57bf4a2c8630ec92666e24995836
|
7
|
+
data.tar.gz: 58552dc8616730520832dc84e5e9f9dc82f45ed1bd4c9987607cf7be61addaca35970534c350d13a9182077c09eece677adcd8e2132e028f6b6bb5141edba931
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# google-cloud-translate
|
2
2
|
|
3
|
-
[Google
|
3
|
+
[Google Cloud Translation API](https://cloud.google.com/translation/) ([docs](https://cloud.google.com/translation/docs)) provides a simple, programmatic interface for translating an arbitrary string into any supported language. It is highly responsive, so websites and applications can integrate with Translation API for fast, dynamic translation of source text. Language detection is also available in cases where the source language is unknown.
|
4
4
|
|
5
|
-
|
5
|
+
Translation API supports more than one hundred different languages, from Afrikaans to Zulu. Used in combination, this enables translation between thousands of language pairs. Also, you can send in HTML and receive HTML with translated text back. You don't need to extract your source text or reassemble the translated content.
|
6
6
|
|
7
7
|
- [google-cloud-translate API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-translate/master/google/cloud/translate)
|
8
8
|
- [google-cloud-translate on RubyGems](https://rubygems.org/gems/google-cloud-translate)
|
9
|
-
- [Google
|
9
|
+
- [Google Cloud Translation API documentation](https://cloud.google.com/translation/docs)
|
10
10
|
|
11
11
|
## Quick Start
|
12
12
|
|
@@ -16,7 +16,7 @@ $ gem install google-cloud-translate
|
|
16
16
|
|
17
17
|
## Authentication
|
18
18
|
|
19
|
-
Like other Cloud Platform services, Google
|
19
|
+
Like other Cloud Platform services, Google Cloud Translation API supports
|
20
20
|
authentication using a project ID and OAuth 2.0 credentials. In addition,
|
21
21
|
it supports authentication using a public API access key. (If both the API
|
22
22
|
key and the project and OAuth 2.0 credentials are provided, the API key
|
@@ -24,10 +24,10 @@ require "google/cloud"
|
|
24
24
|
module Google
|
25
25
|
module Cloud
|
26
26
|
##
|
27
|
-
# Creates a new object for connecting to the
|
28
|
-
#
|
27
|
+
# Creates a new object for connecting to the Cloud Translation API. Each
|
28
|
+
# call creates a new connection.
|
29
29
|
#
|
30
|
-
# Like other Cloud Platform services, Google
|
30
|
+
# Like other Cloud Platform services, Google Cloud Translation API supports
|
31
31
|
# authentication using a project ID and OAuth 2.0 credentials. In addition,
|
32
32
|
# it supports authentication using a public API access key. (If both the API
|
33
33
|
# key and the project and OAuth 2.0 credentials are provided, the API key
|
@@ -77,10 +77,10 @@ module Google
|
|
77
77
|
end
|
78
78
|
|
79
79
|
##
|
80
|
-
# Creates a new object for connecting to the
|
81
|
-
#
|
80
|
+
# Creates a new object for connecting to the Cloud Translation API. Each
|
81
|
+
# call creates a new connection.
|
82
82
|
#
|
83
|
-
# Like other Cloud Platform services, Google
|
83
|
+
# Like other Cloud Platform services, Google Cloud Translation API supports
|
84
84
|
# authentication using a project ID and OAuth 2.0 credentials. In addition,
|
85
85
|
# it supports authentication using a public API access key. (If both the API
|
86
86
|
# key and the project and OAuth 2.0 credentials are provided, the API key
|
@@ -88,8 +88,8 @@ module Google
|
|
88
88
|
# [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-translate/guides/authentication).
|
89
89
|
#
|
90
90
|
# @param [String] key a public API access key (not an OAuth 2.0 token)
|
91
|
-
# @param [String] project
|
92
|
-
# are connecting
|
91
|
+
# @param [String] project Identifier for the Cloud Translation API project
|
92
|
+
# to which you are connecting.
|
93
93
|
# @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
|
94
94
|
# file path the file must be readable.
|
95
95
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
@@ -19,16 +19,16 @@ require "google/cloud/translate/api"
|
|
19
19
|
module Google
|
20
20
|
module Cloud
|
21
21
|
##
|
22
|
-
# # Google
|
22
|
+
# # Google Cloud Translation API
|
23
23
|
#
|
24
|
-
# [Google
|
25
|
-
# simple, programmatic interface for translating an arbitrary
|
26
|
-
# any supported language. It is highly responsive, so websites
|
27
|
-
# applications can integrate with
|
24
|
+
# [Google Cloud Translation API](https://cloud.google.com/translation/)
|
25
|
+
# provides a simple, programmatic interface for translating an arbitrary
|
26
|
+
# string into any supported language. It is highly responsive, so websites
|
27
|
+
# and applications can integrate with Translation API for fast, dynamic
|
28
28
|
# translation of source text. Language detection is also available in cases
|
29
29
|
# where the source language is unknown.
|
30
30
|
#
|
31
|
-
#
|
31
|
+
# Translation API supports more than one hundred different languages, from
|
32
32
|
# Afrikaans to Zulu. Used in combination, this enables translation between
|
33
33
|
# thousands of language pairs. Also, you can send in HTML and receive HTML
|
34
34
|
# with translated text back. You don't need to extract your source text or
|
@@ -47,7 +47,7 @@ module Google
|
|
47
47
|
#
|
48
48
|
# ## Authenticating
|
49
49
|
#
|
50
|
-
# Like other Cloud Platform services, Google
|
50
|
+
# Like other Cloud Platform services, Google Cloud Translation API supports
|
51
51
|
# authentication using a project ID and OAuth 2.0 credentials. In addition,
|
52
52
|
# it supports authentication using a public API access key. (If both the API
|
53
53
|
# key and the project and OAuth 2.0 credentials are provided, the API key
|
@@ -79,7 +79,7 @@ module Google
|
|
79
79
|
#
|
80
80
|
# You may want to use the `from` option to specify the language of the
|
81
81
|
# source text, as the following example illustrates. (Single words do not
|
82
|
-
# give
|
82
|
+
# give Translation API much to work with.)
|
83
83
|
#
|
84
84
|
# ```ruby
|
85
85
|
# require "google/cloud/translate"
|
@@ -130,8 +130,8 @@ module Google
|
|
130
130
|
# ## Detecting languages
|
131
131
|
#
|
132
132
|
# You can use {Google::Cloud::Translate::Api#detect} to see which language
|
133
|
-
# the
|
134
|
-
# `confidence` score is a float value between `0` and `1`.
|
133
|
+
# the Translation API ranks as the most likely source language for a text.
|
134
|
+
# The `confidence` score is a float value between `0` and `1`.
|
135
135
|
#
|
136
136
|
# ```ruby
|
137
137
|
# require "google/cloud/translate"
|
@@ -165,7 +165,7 @@ module Google
|
|
165
165
|
#
|
166
166
|
# ## Listing supported languages
|
167
167
|
#
|
168
|
-
#
|
168
|
+
# Translation API adds new languages frequently. You can use
|
169
169
|
# {Google::Cloud::Translate::Api#languages} to query the list of supported
|
170
170
|
# languages.
|
171
171
|
#
|
@@ -218,19 +218,19 @@ module Google
|
|
218
218
|
#
|
219
219
|
module Translate
|
220
220
|
##
|
221
|
-
# Creates a new object for connecting to
|
222
|
-
#
|
221
|
+
# Creates a new object for connecting to Cloud Translation API. Each call
|
222
|
+
# creates a new connection.
|
223
223
|
#
|
224
|
-
# Like other Cloud Platform services, Google
|
225
|
-
# authentication using a project ID and OAuth 2.0 credentials. In
|
224
|
+
# Like other Cloud Platform services, Google Cloud Translation API
|
225
|
+
# supports authentication using a project ID and OAuth 2.0 credentials. In
|
226
226
|
# addition, it supports authentication using a public API access key. (If
|
227
227
|
# both the API key and the project and OAuth 2.0 credentials are provided,
|
228
228
|
# the API key will be used.) Instructions and configuration options are
|
229
229
|
# covered in the [Authentication
|
230
230
|
# Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-translate/guides/authentication).
|
231
231
|
#
|
232
|
-
# @param [String] project
|
233
|
-
# are connecting
|
232
|
+
# @param [String] project Identifier for the Cloud Translation API project
|
233
|
+
# to which you are connecting.
|
234
234
|
# @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
|
235
235
|
# file path the file must be readable.
|
236
236
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
|
@@ -25,15 +25,15 @@ module Google
|
|
25
25
|
##
|
26
26
|
# # Api
|
27
27
|
#
|
28
|
-
# Represents top-level access to the Google
|
29
|
-
# supports more than
|
30
|
-
# Used in combination, this enables translation between
|
31
|
-
# language pairs. Also, you can send in HTML and receive HTML
|
32
|
-
# translated text back. You don't need to extract your source text or
|
28
|
+
# Represents top-level access to the Google Cloud Translation API.
|
29
|
+
# Translation API supports more than one hundred different languages, from
|
30
|
+
# Afrikaans to Zulu. Used in combination, this enables translation between
|
31
|
+
# thousands of language pairs. Also, you can send in HTML and receive HTML
|
32
|
+
# with translated text back. You don't need to extract your source text or
|
33
33
|
# reassemble the translated content.
|
34
34
|
#
|
35
|
-
# @see https://cloud.google.com/
|
36
|
-
#
|
35
|
+
# @see https://cloud.google.com/translation/docs/getting-started
|
36
|
+
# Cloud Translation API Quickstart
|
37
37
|
#
|
38
38
|
# @example
|
39
39
|
# require "google/cloud/translate"
|
@@ -55,7 +55,7 @@ module Google
|
|
55
55
|
attr_accessor :service
|
56
56
|
|
57
57
|
##
|
58
|
-
# @private Creates a new
|
58
|
+
# @private Creates a new Api instance.
|
59
59
|
#
|
60
60
|
# See {Google::Cloud.translate}
|
61
61
|
def initialize service
|
@@ -63,7 +63,7 @@ module Google
|
|
63
63
|
end
|
64
64
|
|
65
65
|
##
|
66
|
-
# The
|
66
|
+
# The Cloud Translation API project connected to.
|
67
67
|
#
|
68
68
|
# @example
|
69
69
|
# require "google/cloud/translate"
|
@@ -91,8 +91,8 @@ module Google
|
|
91
91
|
##
|
92
92
|
# Returns text translations from one language to another.
|
93
93
|
#
|
94
|
-
# @see https://cloud.google.com/
|
95
|
-
#
|
94
|
+
# @see https://cloud.google.com/translation/docs/translating-text#Translate
|
95
|
+
# Translating Text
|
96
96
|
#
|
97
97
|
# @param [String] text The text or texts to translate.
|
98
98
|
# @param [String] to The target language into which the text should be
|
@@ -104,8 +104,8 @@ module Google
|
|
104
104
|
# 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
105
105
|
# language code. This is optional.
|
106
106
|
# @param [String] format The format of the text. Possible values include
|
107
|
-
# `:text` and `:html`. This is optional. The
|
108
|
-
# `:html`.
|
107
|
+
# `:text` and `:html`. This is optional. The Translation API default
|
108
|
+
# is `:html`.
|
109
109
|
# @param [String] model The model used by the service to perform the
|
110
110
|
# translation. The neural machine translation model (`nmt`) is billed
|
111
111
|
# as a premium edition feature. If this is set to `base`, then the
|
@@ -199,8 +199,8 @@ module Google
|
|
199
199
|
# Detect the most likely language or languages of a text or multiple
|
200
200
|
# texts.
|
201
201
|
#
|
202
|
-
# @see https://cloud.google.com/
|
203
|
-
#
|
202
|
+
# @see https://cloud.google.com/translation/docs/detecting-language
|
203
|
+
# Detecting Language
|
204
204
|
#
|
205
205
|
# @param [String] text The text or texts upon which language detection
|
206
206
|
# should be performed.
|
@@ -242,8 +242,8 @@ module Google
|
|
242
242
|
# List the languages supported by the API. These are the languages to
|
243
243
|
# and from which text can be translated.
|
244
244
|
#
|
245
|
-
# @see https://cloud.google.com/
|
246
|
-
#
|
245
|
+
# @see https://cloud.google.com/translation/docs/discovering-supported-languages
|
246
|
+
# Discovering Supported Languages
|
247
247
|
#
|
248
248
|
# @param [String] language The language and collation in which the names
|
249
249
|
# of the languages are returned. If this is `nil` then no names are
|
@@ -19,7 +19,7 @@ module Google
|
|
19
19
|
module Cloud
|
20
20
|
module Translate
|
21
21
|
##
|
22
|
-
# @private Represents the OAuth 2.0 signing logic for
|
22
|
+
# @private Represents the OAuth 2.0 signing logic for Translation API.
|
23
23
|
class Credentials < Google::Cloud::Credentials
|
24
24
|
SCOPE = ["https://www.googleapis.com/auth/cloud-platform"]
|
25
25
|
PATH_ENV_VARS = %w(TRANSLATE_KEYFILE GOOGLE_CLOUD_KEYFILE
|
@@ -22,8 +22,8 @@ module Google
|
|
22
22
|
# Represents a detect language query result. Returned by
|
23
23
|
# {Google::Cloud::Translate::Api#detect}.
|
24
24
|
#
|
25
|
-
# @see https://cloud.google.com/
|
26
|
-
#
|
25
|
+
# @see https://cloud.google.com/translation/docs/detecting-language
|
26
|
+
# Detecting Language
|
27
27
|
#
|
28
28
|
# @example
|
29
29
|
# require "google/cloud/translate"
|
@@ -22,8 +22,8 @@ module Google
|
|
22
22
|
# Represents a supported languages query result. Returned by
|
23
23
|
# {Google::Cloud::Translate::Api#languages}.
|
24
24
|
#
|
25
|
-
# @see https://cloud.google.com/
|
26
|
-
#
|
25
|
+
# @see https://cloud.google.com/translation/docs/discovering-supported-languages
|
26
|
+
# Discovering Supported Languages
|
27
27
|
#
|
28
28
|
# @example
|
29
29
|
# require "google/cloud/translate"
|
@@ -23,7 +23,7 @@ module Google
|
|
23
23
|
module Translate
|
24
24
|
##
|
25
25
|
# @private
|
26
|
-
# Represents the
|
26
|
+
# Represents the Translation API REST service, exposing the API calls.
|
27
27
|
class Service #:nodoc:
|
28
28
|
API_VERSION = "v2"
|
29
29
|
API_URL = "https://translation.googleapis.com"
|
@@ -22,8 +22,8 @@ module Google
|
|
22
22
|
# Represents a translation query result. Returned by
|
23
23
|
# {Google::Cloud::Translate::Api#translate}.
|
24
24
|
#
|
25
|
-
# @see https://cloud.google.com/
|
26
|
-
#
|
25
|
+
# @see https://cloud.google.com/translation/docs/translating-text#Translate
|
26
|
+
# Translating Text
|
27
27
|
#
|
28
28
|
# @example
|
29
29
|
# require "google/cloud/translate"
|
@@ -99,11 +99,11 @@ module Google
|
|
99
99
|
|
100
100
|
##
|
101
101
|
# Determines if the source language was detected by the Google Cloud
|
102
|
-
#
|
102
|
+
# Cloud Translation API.
|
103
103
|
#
|
104
104
|
# @return [Boolean] `true` if the source language was detected by the
|
105
|
-
#
|
106
|
-
# the request
|
105
|
+
# Cloud Translation API, `false` if the source language was provided
|
106
|
+
# in the request
|
107
107
|
def detected?
|
108
108
|
@detected
|
109
109
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.
|
4
|
+
version: 0.22.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -165,7 +165,8 @@ dependencies:
|
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: 0.1.8
|
168
|
-
description: google-cloud-translate is the official library for Google
|
168
|
+
description: google-cloud-translate is the official library for Google Cloud Translation
|
169
|
+
API.
|
169
170
|
email:
|
170
171
|
- mike@blowmage.com
|
171
172
|
- quartzmo@gmail.com
|
@@ -205,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
206
|
version: '0'
|
206
207
|
requirements: []
|
207
208
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.6.8
|
209
210
|
signing_key:
|
210
211
|
specification_version: 4
|
211
|
-
summary: API Client library for Google
|
212
|
+
summary: API Client library for Google Cloud Translation API
|
212
213
|
test_files: []
|