Issue with Google Translation on Website?

时间秒杀一切 提交于 2019-11-29 16:12:51

Paste the code below on your website. Languages mentioned in includedLanguages in googleTranslateElementInit() will display on your website.

I will suggest you to paste this in website header or footer section so that translation feature will yield on every page of your website.

<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'en,fr,es,it,de'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Also if you are looking for auto translate in specific language then use this code along with above.

<script>
(function() {
if(!window.location.hash) {
    window.location = window.location + '#googtrans(en|fr)';
    window.location.reload();
} 
})();   
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!