0

My site uses a plugin (Google Language Translator) to apply a Google translation of the text (see page here--the flags at the top of the page switch the language). If I change to another language, close the browser, re-open the browser, and re-open my page, the same language is displayed. How does the browser know to display in the same language as before?

Is there some variable set somewhere? Perhaps a cookie, or session ID? Or perhaps some kind of JavaScript variable? I've looked through the source code, but can't see anything obvious.

I have tried contacting the plugin developer, but they have not responded :-/

The motivation for my question is because I have now used a separate plugin (WPML) to create a manual French translation of my site. But when a visitor switches between the Google translations and this manual French site, there are issues. For example, if a visitor switches to Chinese, then tries to access the French site, the page is displayed like so. On first glance, it appears that the browser continues to think a Chinese Google translation needs to be applied.

0

The replies in this outside thread led me to discover that a cookie is indeed being set in the browser that instructs a Google translation to be applied. This is the information I was after.

edit: Specifically, the plugin displays the Google Language Bar on my site. When a visitor uses this language bar to switch the language of the page, a googtrans cookie is set on my page, corresponding to the indicated language (screenshot). As I understand, the cookie is added by an external script hosted by Google, not by the plugin. So I cannot delete the cookie, or cause it to expire.

  • Hi can you please post the snippet that helped you as a link to the page might not work in the future. Thanks! – Nathaniel Flick Oct 10 '17 at 13:06
  • @NathanielFlick Done. – cag8f Oct 10 '17 at 20:47
  • That cookie would be set in the users browser, not on your page (I hope!). Have you seen this? You can tell your page what default languages it supports, might help? support.google.com/translate/answer/2534601?hl=en Can you give a url for your page so we can troubleshoot? – Nathaniel Flick Oct 10 '17 at 20:58
  • @NathanielFlick Yes, my mistake--the cookie is set in the browser, not on the page. The URL of the site is: dev.horizonhomes-samui.com And I have not seen that Google Translator tool--I will take a look and see if it is viable in my case. Just to be clear though, I know the answer to my original question. The overall task is still ongoing. If you can provide suggestions, that would be great. But I'm not sure if mods would like it if we continued the conversation in this question. If you want, that Reddit thread I linked before is still ongoing. – cag8f Oct 11 '17 at 5:34
  • Ok, also the user normally chooses the language so that should solve it? – Nathaniel Flick Oct 11 '17 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.