Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Google Translate API Constructor

I'm currently trying to implement the Google Translate API in my nodejs app. After a some trial and error (and googling) I finally figured out how to properly instantiate a new Translate object by passing in an object with a projectId and credentials.

However, my figuring out how to do this was mostly luck. Where would I actually find the documentation from google about what should go in this constructor? The closest I've found is this documentation that shows that the constructor takes a TranslateConfig but doesn't actually explain what the config is.

const GOOGLE_CREDENTIAL = JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIAL);
async function translateText() {
  const translate = new Translate({projectId: GOOGLE_CREDENTIAL.project_id, credentials: GOOGLE_CREDENTIAL});
  let myTranslate = await translate.translate('who are you', 'es');
  console.log(myTranslate);
}

TLDR: Where do I find documentation that explains the valid arguments for this constructor?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use search input at the top of the page you've referenced to gain access to the specification of what TranslateConfig is:

https://cloud.google.com/nodejs/docs/reference/translate/latest/translate/v2.translateconfig?hl=en

You can see there that by itself it exposes only apiEndpoint, autoRetry, key and maxRetries properties, but inherits a bunch of properties of the GoogleAuthOptions interface.

You can also check the the official Git repository - maybe it will be of more use to you:

https://github.com/googleapis/nodejs-translate

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!