Created
August 6, 2014 11:16
-
-
Save gingerbeardman/722cc38de3842eda16d1 to your computer and use it in GitHub Desktop.
JavaScript to show translation of current tweet
This file contains hidden or 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
| var language = window.navigator.userLanguage || window.navigator.language; | |
| language = language.substring(0, 2); | |
| var url = document.location.href; | |
| var tweet = url.split("/")[5]; | |
| var translation = "https://twitter.com/i/translations/show.json?dest=" + language + "&id=" + tweet; | |
| document.location.href = translation; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bookmarklet: link