Send to Kindle

## Bookmarklet to translate selected texts

### Motivation

I thought there may be people who wished web browser can translate the web pages written in foreign languages. So, I created a bookmarklet that displays the translated text on the same page. It works on iPad and other web browses on PC (*).

### How to install the translation bookmarklet

In essence, the installation completes just by bookmarking the link below.

Translate << bookmark this!

#### How to add bookmark on PC

If you use the web browsers such as Chrome or Safari, you drag and drop the link using left mouse button. If you are using Internet Explorer, right click on the link and "Add to Favorites...".

You cannot bookmark on iPad in the above method, so try this:

1. Bookmark this page 2. Copy the code inside the box below

 javascript:(function(){var%20b=document.body;if(b&&!document.xmlVersion){var%20z=document.getElementById('DT_____');if(z){z.parentNode.removeChild(z);}z=document.createElement('script');b.appendChild(z);z.id='DT_____';z.src='http://daigotanaka.org/translate/translate.js.php?lang=en';}else{}})() 
3. Edit the bookmark you created at Step 1 by replacing the link with the text you copied in Step 2. In other words, your original book mark contained the link as "http://daigotanaka.org/?p=912". Erase this, and paste the text you copied at Step 2. 4. If you are doing this with iPad, the bookmark needs to be appearing in Bookmark bar as in the image above.

That is all for the installation.

### How to use it

Highlight the foreign text, and choose the bookmark. A small frame will open in the same page at the top right corner. You can make the frame bigger or smaller by clicking on the magnifier icon. Click X to close the frame. If you highlight other text and choose the bookmark without closing the frame, the translated text will be updated with the new one.The quality is just machine-translation level after all, but it can auto-detect the language and translate for you.

### Note

• (*) Currently, I check the bookmarklet to work on iPad, Chrome, Safari and Internet Explorer 7 or later. (Please leave the comment if you find it working on other platforms)
• Be sure that JavaScript is executing on your browser.
• This bookmarklet is using Google Translate. If something changes in the Google Translate service, I will change the content of this page without notifying the users. Or the bookmarklet's performance get shaky depending on the server condition. I take no responsibility on the consequence of using this tool :)
• I've sometimes seen the translation frame's design breaks on iPad. Try clicking the magnifier icon to make the frame bigger, it often makes it easier to read the translation.
• Please check manuals of the operation systems and web browsers for the details on how to add bookmark.
• Unfortunately, I don't think it works on iPhone

### Miscellaneous

• By default, it translates text into English. You can choose the target language by choosing from the pull-down menu.
• You can change the red text "en" in the code above into the other language codeso it will become the default target language. (Ex: Make it "ja" for Japanese.)

### Known issues

• It does not handle certain languages very well especially two-byte Asian languages on Safari.

Like this project?
Support by tipping a dollar, or any amount you desire :)

Original post: June 13, 2011 | Last updated: June 13, 2011