Skip to content

Commit

Permalink
Change quickstart style. (#221)
Browse files Browse the repository at this point in the history
* Change quickstart style.

* Fix test.
  • Loading branch information
jmdobry authored and Ace Nassri committed Nov 17, 2022
1 parent d49bcde commit aeb8001
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions translate/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@
'use strict';

// [START translate_quickstart]
// Imports and instantiates the Google Cloud client library
const translate = require('@google-cloud/translate')({
key: 'YOUR_API_KEY'
// Imports the Google Cloud client library
const Translate = require('@google-cloud/translate');

// Your Translate API key
const apiKey = 'YOUR_API_KEY';

// Instantiates a client
const translateClient = Translate({
key: apiKey
});

// The text to translate
const text = 'Hello, world!';
// The target language
const target = 'ru';

// Translates some text into Russian
translate.translate('Hello, world!', 'ru', (err, translation) => {
translateClient.translate(text, target, (err, translation) => {
if (!err) {
// The text was translated successfully
}
Expand Down

0 comments on commit aeb8001

Please sign in to comment.