【问题标题】:How to remove the "powered by google translate" and translate web page by google translator from the dropdown of specific languages如何从特定语言的下拉列表中删除“由谷歌翻译提供支持”并通过谷歌翻译翻译网页
【发布时间】:2021-04-25 11:59:22
【问题描述】:

我想在下拉菜单的标题和底部删除“由谷歌翻译提供支持”

我只需要特定语言下拉菜单

代码

<!DOCTYPE html>
<html lang="en-US">
  <body>

   <h1>My Web Page</h1>
   <p>Hello everybody!</p>
   <p>Translate this page:</p>

   <div id="google_translate_element"></div>

   <script type="text/javascript">
     function googleTranslateElementInit() {
         new google.translate.TranslateElement({ pageLanguage: 'en' }, 'google_translate_element');
     }
   </script>

   <script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

   <p>You can translate the content of this page by selecting a language in the select box.</p>

 </body>
 </html>

【问题讨论】:

    标签: javascript html jquery google-translate translate


    【解决方案1】:

    您可以在CSS 文件中添加这些代码行:

    body {
    top: 0px !important; 
    }
    
    .goog-logo-link {
        display:none !important;
    } 
        
    .goog-te-gadget {
        color: transparent !important;
    }
    
    .goog-te-banner-frame.skiptranslate {
    display: none !important;
    } 
    

    【讨论】:

    • 是的@Niranjan-Hira 它隐藏了“由谷歌翻译提供支持”下拉菜单的底部,但我还需要删除标题 iframe
    • 现在,在您的CSS 文件body {top: 0px !important;}.goog-te-banner-frame.skiptranslate {display: none !important;} 中添加这些代码行
    • 一切正常,谢谢@Niranjan-Hira :) 对于特定语言,我使用 {includedLanguages: 'en,zh-CN,'} 而不是 { pageLanguage: 'en' }
    • 如果我想使用标志图标而不是下拉菜单,我该怎么做
    • 如果您想要标志图标,请阅读以下内容:stackoverflow.com/questions/10486833/…
    猜你喜欢
    • 2019-05-29
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-04
    相关资源
    最近更新 更多