@google-cloud/translate

The @google-cloud/translate package has the following named exports:

  • Translate class - constructor for v2 of the Translation API. See Translate and ClientConfig for client methods and configuration options. Provides TypeScript types out-of-the-box.
  • v3beta1 - client for the v3beta1 backend service version. It exports:
Source:
Examples
<caption>Install the v2 client library with <a
href="https://www.npmjs.com/">npm</a>:</caption> npm install --save

Import the v2 client library:

const {Translate} = require('@google-cloud/translate');
<caption>Create a v2 client that uses <a
href="https://goo.gl/64dyYX">Application Default Credentials
(ADC)</a>:</caption> const client = new Translate();
<caption>Create a v2 client with <a
href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption> const client
= new Translate({ projectId: 'your-project-id', keyFilename:
'/path/to/keyfile.json',
});

include:samples/quickstart.js

region_tag:translate_quickstart
Full quickstart example:

Install the v3beta1 client library:

npm install --save @google-cloud/translate

Import the v3beta1 client library:

const {TranslationServiceClient} =
require('@google-cloud/translate').v3beta1;