Skip to content

Commit 5338dc1

Browse files
author
remi Taylor
committed
Update Translate sample README and rename sample file
1 parent d35616b commit 5338dc1

3 files changed

Lines changed: 41 additions & 9 deletions

File tree

translate/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
22

33
# Google Cloud Translate API Ruby Samples
4+
5+
6+
With the [Google Translate API][translate_docs], you can dynamically translate
7+
text between thousands of language pairs.
8+
9+
[translate_docs]: https://cloud.google.com/translate/docs/
10+
11+
## Run sample
12+
13+
To run the sample, first install dependencies:
14+
15+
bundle install
16+
17+
Run the sample:
18+
19+
bundle exec ruby translate_samples.rb
20+
21+
Usage:
22+
23+
Usage: ruby translate_samples.rb <command> [arguments]
24+
25+
Commands:
26+
translate <desired-language-code> <text>
27+
detect_language <text>
28+
list_names <language-code-for-display>
29+
list_codes
30+
31+
Examples:
32+
ruby translate_samples.rb translate fr "Hello World"
33+
ruby translate_samples.rb detect_language "Hello World"
34+
ruby translate_samples.rb list_codes
35+
ruby translate_samples.rb list_names en
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
require_relative "../samples"
15+
require_relative "../translate_samples"
1616
require "rspec"
1717

1818
RSpec.describe "Google Translate API samples" do
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ def list_supported_language_names api_key:, language_code: "en"
9898
list_supported_language_names api_key: api_key, language_code: ARGV.shift
9999
else
100100
puts <<-usage
101-
Usage: ruby samples.rb <command> [arguments]
101+
Usage: ruby translate_samples.rb <command> [arguments]
102102
103103
Commands:
104-
translate <desired-language-code> "<text>"
105-
detect_language "<text>"
104+
translate <desired-language-code> <text>
105+
detect_language <text>
106+
list_names <language-code-for-display>
106107
list_codes
107-
list_names <language-code-for-display>
108108
109109
Examples:
110-
ruby samples.rb translate fr "Hello World"
111-
ruby samples.rb detect_language "Hello World"
112-
ruby samples.rb list_codes
113-
ruby samples.rb list_names en
110+
ruby translate_samples.rb translate fr "Hello World"
111+
ruby translate_samples.rb detect_language "Hello World"
112+
ruby translate_samples.rb list_codes
113+
ruby translate_samples.rb list_names en
114114
usage
115115
end
116116
end

0 commit comments

Comments
 (0)