I'm trying to embed Google Translate snippet in my website, but for some reason it is not even displayed. I go here: Google tools
Copy this:
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Paste it to my webpage. And I don't see it there.
What am I missing? Some HTML maybe?
Here is a working example. I think you are missing "&ug=section&hl={LANGUAGE}" parameters:
My Page Тестирование
<script>
function googleSectionalElementInit() {
new google.translate.SectionalElement({
sectionalNodeClassName: 'translate',
controlNodeClassName: 'translate_control',
background: '#f4fa58'
}, 'google_sectional_element');
}
</script>
<script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=en"></script>
http://jsfiddle.net/maxim75/H3Wkr/ - working example
In the HTML, the 'control' class element needs to be nested in the 'section' element. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With