Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[33,453 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 whoever posted them. This site is not responsible for what they say.
A JavaScript bookmark to translate webpages
Authored by: billbarstad on Jul 07, '05 10:06:12AM

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 Jul 07, '05 12:44:00PM

Awesome. Nice hint.



[ Reply to This | # ]
A JavaScript bookmark to translate webpages
Authored by: drei on Jul 08, '05 05:09:10AM
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 Jul 10, '05 04:27:55PM

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 Jul 08, '05 12:12:20PM

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 Dec 12, '05 10:17:31AM
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 Dec 12, '05 10:19:55AM

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 Apr 10, '06 01:24:31PM

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 Mar 06, '07 08:15:58AM
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 Jan 22, '08 12:28:51AM

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 Jan 22, '08 12:41:45AM

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 Jul 26, '09 04:18:13PM
A JavaScript bookmark to translate webpages
Authored by: Wifi on Aug 12, '09 04:02:57AM
This will surly be helpful in Promoting my wifi technology blog to non english traffic

[ Reply to This | # ]