Support » Plugin: Translate WordPress with GTranslate » Widget code pushes admin bar down

Viewing 8 replies - 1 through 8 (of 8 total)
  • Here is the widget code, the only thing I changed was to remove the “Please Select” option.

    <!-- GTranslate: https://gtranslate.io/ -->
     <select onchange="doGTranslate(this);" class="notranslate" id="gtranslate_selector" aria-label="Website Language Selector"><option value="en|en">English</option><option value="en|ru">Russian</option><option value="en|es">Spanish</option></select><style type="text/css">
    #goog-gt-tt {display:none !important;}
    .goog-te-banner-frame {display:none !important;}
    .goog-te-menu-value:hover {text-decoration:none !important;}
    .goog-text-highlight {background-color:transparent !important;box-shadow:none !important;}
    body {top:0 !important;}
    #google_translate_element2 {display:none!important;}
    </style>
    
    <div id="google_translate_element2"></div>
    <script type="text/javascript">
    function googleTranslateElementInit2() {new google.translate.TranslateElement({pageLanguage: 'en',autoDisplay: false}, 'google_translate_element2');}
    </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit2"></script>
    
    <script type="text/javascript">
    function GTranslateGetCurrentLang() {var keyValue = document['cookie'].match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}
    function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}
    function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(/goog-te-combo/.test(sel[i].className)){teCombo=sel[i];break;}if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}
    </script>
    Plugin Author edo888

    (@edo888)

    Thanks for the info! 🙂

    Maybe this will be fixed ina future update? But I wouldn’t call this resolved.

    Plugin Author edo888

    (@edo888)

    I think it is only because you do not follow the guidelines to place the language selector and you are copy pasting the code, which is not a correct way to do it.

    We specifically mention this under Widget Code (from where you have copied the code obviously):

    DO NOT COPY THIS INTO YOUR POSTS OR PAGES! Use [GTranslate] shortcode inside the post/page or add a GTranslate widget into your sidebar from Appearance -> Widgets instead.

    OK well, this other site is not using the widget and it behaves the same. It’s using the “Show floating language selector: Top Right”. https://cl.ly/8d53cd25e09e

    Plugin Author edo888

    (@edo888)

    I have just checked and it doesn’t happen for me. Please contact our live chat and provide us access, so I can check the issue on your website.

    https://gtranslate.io/#contact

    Thanks! 🙂

    Thanks for the offer to look into it, but I think I’ll pass on that. It only shows to admin users so I guess I’ll leave it as-is for now.

    As a test, I just set up a brand new installation of WordPress locally. Stock theme TwentyNineteen, the only plugin installed is Gtranslate. Selected “Show floating language selector: Top Right”. Same results, a gap at the top for admin users. https://cl.ly/741949fbbf2a. That’s three different sites I’m getting this on, so I don’t think it’s just my site that is the issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.