File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,13 @@ https://cloud.google.com/translate/).
1313## Build and Run
14141 . ** Enable APIs** - [ Enable the Translate API] ( https://console.cloud.google.com/flows/enableapi?apiid=translate )
1515 and create a new project or select an existing project.
16- 2 . ** Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
17- and select "API key". Copy the API key.
16+ 2 . ** Download The Credentials** - Configure your project using [ Application Default Credentials] [ adc ] .
17+ Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
18+ and select "Service Account Credentials" and download the credentials file. Then set the path to
19+ this file to the environment variable ` GOOGLE_APPLICATION_CREDENTIALS ` :
20+ ```
21+ $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
22+ ```
18233 . ** Clone the repo** and cd into this directory
1924```
2025 $ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
@@ -58,3 +63,5 @@ Available commands:
5863## Licensing
5964
6065* See [ LICENSE] ( ../LICENSE )
66+
67+ [ adc ] : https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ public function testQuickstart()
2121 if (!$ projectId = getenv ('GOOGLE_PROJECT_ID ' )) {
2222 $ this ->markTestSkipped ('GOOGLE_PROJECT_ID must be set. ' );
2323 }
24+ if (!getenv ('GOOGLE_APPLICATION_CREDENTIALS ' )) {
25+ $ this ->markTestSkipped ('GOOGLE_APPLICATION_CREDENTIALS must be set. ' );
26+ }
2427
2528 $ file = sys_get_temp_dir () . '/translate_quickstart.php ' ;
2629 $ contents = file_get_contents (__DIR__ . '/../quickstart.php ' );
You can’t perform that action at this time.
0 commit comments