Skip to content

Commit 8a7cbba

Browse files
Translate samples.
1 parent 6320a96 commit 8a7cbba

11 files changed

+1336
-0
lines changed

translate/api/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Google Cloud Translate API Samples
2+
3+
These samples show how to use the [Google Cloud Translate API](
4+
https://cloud.google.com/translate/).
5+
6+
## Setup
7+
8+
1. Visit the [Google API Console](
9+
https://pantheon.corp.google.com/apis/dashboard) and enable the Cloud
10+
Translate API.
11+
12+
2. Click `Credentials` -> `Create Credentials` -> `API key`. Copy the
13+
API key.
14+
15+
3. Replace `YOUR-API-KEY` in `translate.php` with your api key copied
16+
in step 2.
17+
18+
4. Run:
19+
```
20+
$ php translate.php
21+
Console Tool
22+
23+
Usage:
24+
command [options] [arguments]
25+
26+
Options:
27+
-h, --help Display this help message
28+
-q, --quiet Do not output any message
29+
-V, --version Display this application version
30+
--ansi Force ANSI output
31+
--no-ansi Disable ANSI output
32+
-n, --no-interaction Do not ask any interactive question
33+
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
34+
35+
Available commands:
36+
detect Detect which language text was written in using Google Cloud Translate API
37+
help Displays help for a command
38+
list Lists commands
39+
list-codes List all the language codes in the Google Cloud Translate API
40+
list-langs List language codes and names in the Google Cloud Translate API
41+
translate Translate text using Google Cloud Translate API
42+
```
43+

translate/api/composer.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "google/translate-sample",
3+
"type": "project",
4+
"require": {
5+
"google/cloud": "^0.11.1",
6+
"symfony/console": "^3.1"
7+
},
8+
"autoload": {
9+
"psr-4": {
10+
"Google\\Cloud\\Samples\\Translate\\": "src/"
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)