Bookmarklet – Firefox Google Translate with Language Prompt

Most of the internet is written in English.  There are web services like Google Translate that can translate non-English pages, but using them requires a distracting trip to Google.

To simplify the process, here is a bookmarklet that takes the current URL and sends it to Google Translate directly.

To create a bookmarklet for Firefox 3 that translates the current web-page from another language to english, create a bookmark and set the bookmark properties to the following values:

Name:

Google Translate - Prompt

Location:

javascript:var%20language=prompt(%22Enter%20source%20language%20code:%20\n\n%20automatic%20-%20au\n%20arabic%20-%20ar\n%20chinese%20simplified%20-%20zh-CN\n%20chinese%20traditional%20-%20zh-TW\n%20french%20-%20fr\n%20german%20-%20de\n%20italian%20-%20it\n%20korean%20-%20ko\n%20portuguese%20-%20pt\n%20russian%20-%20ru\n%20spanish%20-%20es\n%20%22,%22au%22);%20%20if%20(language%20!=%20null)%20{%20location=%22http://translate.google.com/translate?sl=%22%20%2B%20encodeURIComponent(language)%20%2B%20%22&tl=en&u=%22%20%20%2B%20encodeURIComponent(location);%20}

Location (again, this time not encoded, although wordpress seems to maul the quotes and plusses this way):

javascript:var language=prompt("Enter source language code: \n\n automatic - au\n arabic - ar\n chinese simplified - zh-CN\n chinese traditional - zh-TW\n french - fr\n german - de\n italian - it\n korean - ko\n portuguese - pt\n russian - ru\n spanish - es\n","au"); if (language != null) { location="http://translate.google.com/translate?sl=" + encodeURIComponent(language) + "&tl=en&u=" + encodeURIComponent(location); }

Keyword:

bookmarklet,google,translate

Description:

Bookmarklet prompts for the source language of the currently-displayed web-page, and then sends it to google translate with the proper URL to tranlate it (to english). This bookmarklet is based on Google Translation bookmarklet from https://www.squarefree.com/bookmarklets/misc.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s