These things worked for me.
Paste the code below on your website. Languages mentioned in includedLanguages in googleTranslateElementInit() will display on your website.
I will suggest you to paste this in website header or footer section so that translation feature will yield on every page of your website.
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'en,fr,es,it,de'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Also if you are looking for auto translate in specific language then add this piece of code as well.
<script>
(function() {
if(!window.location.hash) {
window.location = window.location + '#googtrans(en|fr)';
window.location.reload();
}
})();
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…