//// 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 themakeAuthenticatedRequestportion 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"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,[]]