diff --git a/packages/google-cloud-translate/.nycrc b/packages/google-cloud-translate/.nycrc index 23e322204ec..367688844eb 100644 --- a/packages/google-cloud-translate/.nycrc +++ b/packages/google-cloud-translate/.nycrc @@ -10,7 +10,6 @@ "**/docs", "**/samples", "**/scripts", - "**/src/**/v*/**/*.js", "**/protos", "**/test", ".jsdoc.js", diff --git a/packages/google-cloud-translate/README.md b/packages/google-cloud-translate/README.md index fd7740ed710..b1b6940e2ba 100644 --- a/packages/google-cloud-translate/README.md +++ b/packages/google-cloud-translate/README.md @@ -60,22 +60,31 @@ npm install @google-cloud/translate ### Using the client library ```javascript + /** + * TODO(developer): Uncomment the following line before running the sample. + */ + // const projectId = 'YOUR_PROJECT_ID'; + // Imports the Google Cloud client library - const {Translate} = require('@google-cloud/translate'); + const {Translate} = require('@google-cloud/translate').v2; // Instantiates a client const translate = new Translate({projectId}); - // The text to translate - const text = 'Hello, world!'; + async function quickStart() { + // The text to translate + const text = 'Hello, world!'; + + // The target language + const target = 'ru'; - // The target language - const target = 'ru'; + // Translates some text into Russian + const [translation] = await translate.translate(text, target); + console.log(`Text: ${text}`); + console.log(`Translation: ${translation}`); + } - // Translates some text into Russian - const [translation] = await translate.translate(text, target); - console.log(`Text: ${text}`); - console.log(`Translation: ${translation}`); + quickStart(); ```