1818function detectLanguage ( text ) {
1919 // [START translate_detect_language]
2020 // Imports the Google Cloud client library
21- const Translate = require ( '@google-cloud/translate' ) ;
21+ const { Translate} = require ( '@google-cloud/translate' ) ;
2222
2323 // Creates a client
2424 const translate = new Translate ( ) ;
@@ -51,7 +51,7 @@ function detectLanguage(text) {
5151function listLanguages ( ) {
5252 // [START translate_list_codes]
5353 // Imports the Google Cloud client library
54- const Translate = require ( '@google-cloud/translate' ) ;
54+ const { Translate} = require ( '@google-cloud/translate' ) ;
5555
5656 // Creates a client
5757 const translate = new Translate ( ) ;
@@ -74,7 +74,7 @@ function listLanguages() {
7474function listLanguagesWithTarget ( target ) {
7575 // [START translate_list_language_names]
7676 // Imports the Google Cloud client library
77- const Translate = require ( '@google-cloud/translate' ) ;
77+ const { Translate} = require ( '@google-cloud/translate' ) ;
7878
7979 // Creates a client
8080 const translate = new Translate ( ) ;
@@ -102,7 +102,7 @@ function listLanguagesWithTarget(target) {
102102function translateText ( text , target ) {
103103 // [START translate_translate_text]
104104 // Imports the Google Cloud client library
105- const Translate = require ( '@google-cloud/translate' ) ;
105+ const { Translate} = require ( '@google-cloud/translate' ) ;
106106
107107 // Creates a client
108108 const translate = new Translate ( ) ;
@@ -138,7 +138,7 @@ function translateText(text, target) {
138138function translateTextWithModel ( text , target , model ) {
139139 // [START translate_text_with_model]
140140 // Imports the Google Cloud client library
141- const Translate = require ( '@google-cloud/translate' ) ;
141+ const { Translate} = require ( '@google-cloud/translate' ) ;
142142
143143 // Creates a client
144144 const translate = new Translate ( ) ;
0 commit comments