Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

A JavaScript bookmark to translate webpages Web Browsers
Want to try converting a Japanese website to English? Create a new bookmark in Safari's bookmarks bar (it doesn't matter for what site), then choose Bookmarks -> Show All Bookmarks and edit the newly-created bookmark. Give it a useful name, and for the URL, enter this string:
javascript:void(location.href='http://translate.google.com/translate?u='+location.href)
Now when you're viewing a Japanese site, just click the toolbar bookmark and you'll see Google's translation of the page.

[robg adds: This should work in any browser, and it should also work for any language that Google can translate, not just Japanese. You can see what languages are possible on Google's Language Tools page. This is a more generic version of this older hint, which did the same thing but required a hard-coded URL for each language.]
    •    
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[21,799 views]  

A JavaScript bookmark to translate webpages | 13 comments | Create New Account
Click here to return to the 'A JavaScript bookmark to translate webpages' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
A JavaScript bookmark to translate webpages
Authored by: billbarstad on Thu, Jul 7 2005 at 10:06AM PDT
Far out! Just tried it on a German language website. Worked perfectly!

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: dogboy on Thu, Jul 7 2005 at 12:44PM PDT
Awesome. Nice hint.

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: drei on Fri, Jul 8 2005 at 5:09AM PDT
If you'd like to have the pages translated to another target language add the parameter "hl=" to the URL.
To translate to german the bookmark would look like this
javascript:void(location.href='http://translate.google.com/translate?hl=de&u='+location.href)


[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: tbucks on Sun, Jul 10 2005 at 4:27PM PDT
I bookmarked the script, just as I did the Japanese one, but it does not work. The Japanese script worked.

What am I doing wrong ?

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: cudaboy_71 on Fri, Jul 8 2005 at 12:12PM PDT
i dont know javascript well enough to tweak this. can anyone post the script to translate text entered?

perhaps capture any text entered into the address field, or maybe pop up a javascript prompt for text, then call the google.com translator with that query.

something like how

[code]
javascript:void(q=prompt('Enter%20text%20to%20search%20using%20Google.',''));if(q)void(location.href='http://www.google.com/search?client=googlet&q='+escape(q))
[/code]

creates a google query from a popup.

the translator script would just return the translated text on the http://www.google.com/language_tools page.

thanks.

---
if it aint broke, break it!

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: kreatix on Mon, Dec 12 2005 at 10:17AM PST
To have the translated page open in a new window, just replace "void" with "window.open". Like this:

javascript:window.open(location.href='http://translate.google.com/translate?hl=de&u='+location.href)


[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: kreatix on Mon, Dec 12 2005 at 10:19AM PST
Oops, I just noticed that the original window will go to the translated page too...
Anyone know how to fix this?

[ Reply to This | # ]
Broken?
Authored by: ben42 on Mon, Apr 10 2006 at 1:24PM PDT
I made a bookmark using this hint and used it happily for many months, but recently it stopped working. Anyone know why? A change on the Google site?

Would love to get it working again.

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: kenji on Tue, Mar 6 2007 at 8:15AM PST
I too have found this to be broken. I tried adding some additional parameters:

javascript:void(location.href='http://translate.google.com/translate?&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools&u='+location.href)

... but it still doesn't work. It seems the URL now specifically encodes for the "before" and "after" languages using the "langpair" attribute, as in this bookmark that translates Spanish to English:

javascript:void(location.href='http://translate.google.com/translate?langpair=es%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools&u='+location.href)

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: jemuel85 on Tue, Jan 22 2008 at 12:28AM PST
How do I locate the java script to set the language translation?

[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: jemuel85 on Tue, Jan 22 2008 at 12:41AM PST
Forget it, I realised that it's universal and works for at least Japanese - English and Deutche - English


[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: tyraconnelluk23 on Sun, Jul 26 2009 at 4:18PM PDT
A JavaScript bookmark to translate webpages
Authored by: Wifi on Wed, Aug 12 2009 at 4:02AM PDT
This will surly be helpful in Promoting my wifi technology blog to non english traffic

[ Reply to This | # ]