How to translate entire website with Google Translate

情到浓时终转凉″ 提交于 2019-11-30 09:41:32

问题


I am currently using the following to translate a web page:

http://translate.google.com/about/intl/en_ALL/tour.html#professional

The problem is, when I put the code snippet generated on the Google site onto my web pages, the user has to choose their language on each page in the website. Is there any way to do it so that the user only chooses once and then every subsequent page they visit in my website gets automatically translated to their chosen language?


回答1:


It appears this problem only shows up when using Google Chrome. Other browsers work fine:

http://groups.google.com/group/google-translate-general/browse_thread/thread/4b48a4f997762692




回答2:


The translation widget at the bottom of this page takes the approach of redirecting to google's page translation service which maintains the language but your page has to run inside a google container:

http://www.toronto.ca/

You might be able to listen to change events on the in-page translation widget and store the selected language in LocalStorage so you can automatically reselect it whenever a new page is loaded. However, this approach is pretty hacky since it could easily break whenever google alters the widget.



来源:https://stackoverflow.com/questions/5507498/how-to-translate-entire-website-with-google-translate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!