The Script
Download the script.
Overview
I've been trying to learn Dutch for the past year or so and it's been through this project that I got the idea to write a program like this. The general idea is simple: if you're to a moderate level in the acquisition of a foreign language but not yet fluent, you probably often find yourself stopping your train of thought to look up words in a dictionary, or perhaps you often just ignore a lot of words you don't know due to the tedium of looking them up. With this script you can use a free online dictionary to look up words as you read them. Just hover your mouse over the word you don't know and press F4. The script will query the online database and if there are any matches it will display the first three in a tooltip above the word. This allows you to more smoothly read the text and can serve to increase your vocabulary.
Technical Details
This is a Greasemonkey UserScript. Greasemonkey is a Firefox extension that allows users to write their own Javascript scripts that alter the behavior of websites to which they browse. Thus, both Firefox and Greasemonkey are necessary in order to run this script. As of writing this, the script has been tested on Firefox 1.0.7 with Greasemonkey 0.5.3 on Linux, Firefox 1.5 with Greasemonkey 0.6.3 on Linux, and Firefox 1.0.7 with Greasemonkey 0.5.3 on Windows.
Installation Instructions
  • First, if you haven't already, install Firefox.
  • Next, you'll need to install Greasemonkey. Make sure you get the right version for your version of Firefox. If you're using Firefox 1.5, you'll need Greasemonkey 0.6.3 and if you're using Firefox 1.0.x you'll need Greasemonkey 0.5.3. Deal with the warning message in your way of choice. You'll need to restart Firefox to activate Greasemonkey.
  • Finally, you can install the script itself. You can either right-click this link and choose "Install User Script" or follow the link and on the page select in the menu "Tools" -> "Install This User Script". Keep the defaults unless you have a reason not to.
  • Now you need to configure the script to use the dictionar(ies) of your choice. Browse to dicts.info, a free online dictionary site. Find a dictionary that translates between the languages you wish and note the values of the k1 and k2 variables in the URL of the page of this dictionary. (I.e. in the location bar you'll see some text that looks like http://dicts.info/d1.php?k1=1&k2=25. Note the two numbers after the k1= and k2=.)
  • Go in the Firefox menu to "Tools" -> "User Script Commands" -> "Manage Dictionaries". The ToolTip Translation window should pop up. You'll need to fill in the k1 and k2 values as noted above. In addition, fill in whether you'll be translating from the left-hand-side language into the right-hand-side language on the dictionary page or vice versa. Finally, fill in the groups of URLs on which you want to use this dictionary and then press the Update button to save your changes. If you change the k1 or k2 values then either the text box for the URLs will be cleared out for you to add new websites or the previous values stored for that dictionary will be loaded for you to see. In order to specify a group of URLs on which to use a particular dictionary you can use the asterisk (*) character. E.g., in order to specify that you want to use the Dutch dictionary on all URLs whose top-level domain ends in .nl, enter 1 in k1, 25, in k2, No if you want to translate from Dutch to English, and finally enter http*://*.nl/* as one of the lines in the Websites box and click the Update button to save. Separate all URL strings with a blank line.
  • In order to see your changes you'll need to refresh the pages you have open. From then on, if you are on a page whose URL you've configured to be matched by one of your specified dictionaries and you want to get a translation of a word, simply hover your mouse over the word and press F4. The first three matches will pop up above the word in a tooltip.