Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

272
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda