//// The environment variable, `GOOGLE_CLOUD_TRANSLATE_ENDPOINT`, is honored as// a custom backend which our library will send requests to.//-
Full quickstart example:
/** * TODO(developer): Uncomment the following line before running the sample. */// const projectId = 'YOUR_PROJECT_ID';// Imports the Google Cloud client libraryconst{Translate}=require('@google-cloud/translate').v2;// Instantiates a clientconsttranslate=newTranslate({projectId});asyncfunctionquickStart(){// The text to translateconsttext='Hello, world!';// The target languageconsttarget='ru';// Translates some text into Russianconst[translation]=awaittranslate.translate(text,target);console.log(`Text: ${text}`);console.log(`Translation: ${translation}`);}quickStart();
A custom request implementation. Requests to this API may optionally use an API key for an application, not a bearer token from a service account. This means it is possible to skip the makeAuthenticatedRequest portion of the typical request lifecycle, and manually authenticate the request here.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,[]]