JS Client for Google Cloud Translation API to translate closed webpage

79 views
Skip to first unread message

Chris

unread,
Jan 11, 2021, 11:44:04 AM1/11/21
to Google Cloud Translation API

Is there a JS client for Google Cloud Translation API to translation closed webpage (area behind login)  via client-side request?

Or is recommend to translate a closed webpage on server-side?

Thanks community!

Jun (Cloud Platform Support)

unread,
Jan 11, 2021, 6:02:37 PM1/11/21
to Google Cloud Translation API
Hey Chris, 

Can you provide more details about closed webpage (area behind login)? However, there is a single version of the Cloud Translation API client library for Node.js at [1] for both Cloud Translation - Advanced and Cloud Translation - Basic that you can take a look to see if it would meet your needs. 

Chris

unread,
Jan 12, 2021, 5:45:05 AM1/12/21
to Google Cloud Translation API
Closed webpage is a webpage not public accessible. You have to login to view it (session). It's kind of a B2B online shop.

We would like to provide this B2B online shop in various languages.

Easy kind of implementation would be an Java script running in browser of webshop visitor which translate webpage in desired language.

But I can't find any java script client or implementation example, so i guess this kind of application is not preferred by google?

Adam Bittlingmayer

unread,
Jan 12, 2021, 8:07:59 AM1/12/21
to Google Cloud Translation API
Hi Chris,

The folks still at Google can correct me if I'm wrong, but basically the Google Translate's Website Translator (a.k.a. widget) is obsolete.  The recommended path for client-side translation is to just let the user's browser handle it.  There was recently a small exception for non-profits in times of global pandemic.

(Also, if you call the API client-side, won't your API key be visible to clients?)

For a shop, even B2B, you're probably better off doing it server-side.  That'll let you get:
- faster page loading
- caching / translation memory
- hybrid translation - catch and fix errors in a targeted way
- multilingual SEO (not as applicable in your case, since it's not on the public web)

I know of a major corporation that tried to do it client-side for a B2B shop, and it was a catastrophe.  (The developer's name was Chris too!).  With shops and marketplaces, improving translation quality and SEO should increase sales to more than cover the cost of a more solid machine translation integration and/or hybrid setup.

Adam

Konstantin Savenkov

unread,
Jan 13, 2021, 7:51:44 PM1/13/21
to Google Cloud Translation API
Hi Chris,

We've developed such a JS widget - it's a one-liner to include in the website footer, which translates a visible part of the webpage into the user locale and works nicely with dynamic content and also all bells and whistles Google Advanced provides (custom models, terminology, notranslate). It also has a caching mechanism to avoid re-translating the same content over and over.

Happy to make you a demo, just let us know at he...@inten.to

cheers,
Konstantin.

Reply all
Reply to author
Forward
0 new messages