MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / listLanguagesSample

Function listLanguagesSample

translate/translate.js:46–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46function listLanguagesSample() {
47 // [START translate_list_codes]
48 // Imports the Google Cloud client library
49 const {Translate} = require('@google-cloud/translate').v2;
50
51 // Creates a client
52 const translate = new Translate();
53
54 async function listLanguages() {
55 // Lists available translation language with their names in English (the default).
56 const [languages] = await translate.getLanguages();
57
58 console.log('Languages:');
59 languages.forEach(language => console.log(language));
60 }
61
62 listLanguages();
63 // [END translate_list_codes]
64}
65
66function listLanguagesWithTargetSample(target) {
67 // [START translate_list_language_names]

Callers 1

translate.jsFile · 0.85

Calls 1

listLanguagesFunction · 0.70

Tested by

no test coverage detected