Created
April 4, 2016 09:09
-
-
Save artturik/15bed885bcec6faa95eb73acb2e2ae54 to your computer and use it in GitHub Desktop.
Forced Google Translate (also can be used as April Fools Day joke)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This code will translate page contents automatically (without user input) | |
Settings located at line 9, current script will translate english to estonian | |
--> | |
<style>#google_translate_element,.skiptranslate{display:none;}body{top:0!important;}</style> | |
<div id="google_translate_element"></div> | |
<script> | |
function googleTranslateElementInit() { | |
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'et', autoDisplay: false}, 'google_translate_element'); | |
var a = document.querySelector("#google_translate_element select"); | |
a.selectedIndex=1; | |
a.dispatchEvent(new Event('change')); | |
} | |
</script> | |
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will only translate the page if the browser is NOT english
Change your chrome browser to a different default language and test it for yourself
https://www.indeed.com/career-advice/career-development/change-language-in-chrome