x

Google Translate Widget showing multiple times

Google Translate have now made their service free again for non-profits linked to Covid.  We've been given the code from Google (below) and added it to a page (https://www.walcotfoundation.org.uk/individuals.html) as Embed Code - it looks fine on the Weebly site but when I publish it, the widget shows multiple times - see screenshot below - any ideas?

image

<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="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

1,910 Views
Message 1 of 5
Report
1 Best Answer

Best Answer

@EdmundWalcot 

Hi Edmund

I just embedded your code in a test site, published and can confirm it works OK. But, when I located one embed element immediately above another one - both containing the same code - I was able to replicate your display problem exactly and only the first drop down menu worked - again, exactly the same as your website.

The interesting thing is, when I added the second embed element, and shifted both widgets to the right side of the element box, both displays disappeared from my edit screen, even though both elements and their code remained in place. So, are you sure you haven't duplicated the code in vertically aligned embed elements (and for some reason, only one is displaying on your edit screen?).  What happens if you delete your code and the embed element and then publish? Do you get a single working copy on your website? 

Gary

View Best Answer >

1,878 Views
Message 6 of 5
Report
4 REPLIES 4

@EdmundWalcot 

The code itself seems OK. However, in my experience these kinds of code/apps are susceptible to fail when third party apps that block trackers and cookies are being used. I'm thinking of Ghostery, Adblock Plus, Privacy Badger etc. To check whether this is the case here, load your site with a browser in incognito mode. If the Google app loads and works OK, that'll probably be the problem (assuming you haven't duplicated the code?).

Hope this helps, Gary

1,902 Views
Message 6 of 5
Report

Thanks for the response - I tried the page in Incognito mode in Google Chrome but it still duplicates and I've checked that there is only one set of code in the Embed Code box.

1,886 Views
Message 6 of 5
Report

Best Answer

@EdmundWalcot 

Hi Edmund

I just embedded your code in a test site, published and can confirm it works OK. But, when I located one embed element immediately above another one - both containing the same code - I was able to replicate your display problem exactly and only the first drop down menu worked - again, exactly the same as your website.

The interesting thing is, when I added the second embed element, and shifted both widgets to the right side of the element box, both displays disappeared from my edit screen, even though both elements and their code remained in place. So, are you sure you haven't duplicated the code in vertically aligned embed elements (and for some reason, only one is displaying on your edit screen?).  What happens if you delete your code and the embed element and then publish? Do you get a single working copy on your website? 

Gary

1,879 Views
Message 6 of 5
Report

Great - that works - we also had it in our footer so that what was causing the problem - thanks!

1,870 Views
Message 6 of 5
Report
This thread has been archived and locked. Please start a new thread if you would like to continue the conversation.