
Home | Gadget Google Translate | Script with language setting English(EN) - Example page
Script with language setting English(EN) - Example page
This page was written in English with the intention of serving as an example and test the script google instant translation. If all goes as expected this page asks if you want to translate it.Script code
The code is placed in the body. To blogger.com, option Html/Javascript
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
gaTrack: true
}, 'google_translate_element');
};
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Since this is an English page is used en
gaTrack: true Analyze the use of translation with Google Analytics
<div id="google_translate_element"></div> Creates an element of language selection(drop-down), equal to the side
pageLanguage: 'en' Language used on the page.
The End
Prevent translation of an html element
For some reason you may want to prevent the translation of an element, sentence or paragraph. Html simply add the element class notranslateSample code does not translate:
<p class="notranslate">no se traducen</p>Result:
no se traducen
Another sample code
<b class="notranslate">Google, please do not traducir this text ;-)</b>
Result:
Google, please do not traducir this text ; -)