HTML – 谷歌翻译网站

前端之家收集整理的这篇文章主要介绍了HTML – 谷歌翻译网站前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
所以我在我的网站上使用谷歌翻译工具 –
我通过以下方式设置它: https://translate.google.com/manager/website

显示模式下,我一直选择自动,但它看起来像横幅总是显示,即使他们声明它只会显示浏览器是否不是网站的语言(这是EN)

这是怎么回事?他们的工具坏了吗?有没有办法使用这个工具来显示语言是否不是en?

解决方法

将以下代码粘贴到您的网站上.包含在googleTranslateElementInit()中的语言中提到的语言将显示在您的网站上.

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.

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

此外,如果您正在寻找特定语言的自动翻译,请使用此代码以及上述代码.

  1. <script>
  2. (function() {
  3. if(!window.location.hash) {
  4. window.location = window.location + '#googtrans(en|fr)';
  5. window.location.reload();
  6. }
  7. })();
  8. </script>

猜你在找的HTML相关文章