To efficiently write a translator, you will first have to download some free software.
The following five programs are essentials for anyone writing a Zotero translator. They are all free-of-charge and come from reputable sources. Please download and install them before continuing.
Zotero is a Firefox add-on; therefore, to use Zotero, we must use Firefox. Don't worry, it's free and safe and very user-friendly. In fact, after a few days of using it, most people never look back.
Zotero is only available with Firefox because Firefox is much more customizable than certain other proprietary internet browsers. The makers of Firefox released all the code that makes up the program and posted it online. This practice, known as "Open Source," is not particularly important for writing a translator, but it was crucial for the Zotero programmers who needed access to Firefox's code in order to write Zotero.
It is possible to install more than one web browser on a computer. If you normally use another browser you don't have to worry about losing it or your bookmarks when you download Firefox.
Zotero runs within Firefox. Once installed, Zotero automatically runs whenever Firefox is in use. Open Zotero by clicking on the icon in the bottom right corner of the browser window. If you have never used Zotero, you can watch a video to help you get started.
Be sure you have the most up to date version of Zotero. You can find this information on the Zotero website.
Scaffold is what's known as a "Sandbox." Using a sandbox essentially means you can muck around with the code without worrying about really messing anything up, since all the important code is kept hidden. In this guide, all code will be written, tested and retested in Scaffold. The makers of Zotero created Scaffold specifically for writing translators.
Once installed, launch Scaffold by navigating to the "Tools" menu in your Firefox window and select "Scaffold."
You will learn in detail how to use Scaffold in Chapter 6.
Solvent is a tool that allows you to create XPaths (think directions for a computer), without actually understanding the code behind the XPath. You will learn how to understand the code, but nonetheless, Solvent is your friend.
Once installed, activate it by clicking on the spray paint icon in the bottom right corner of your Firefox window.
You will learn in detail how to use this program in Chapter 5:
Note: Firefox 3.0 or greater may prevent you from enabling Solvent once installed, citing improper security measures. This message is a result of increased security precautions implemented in the Firefox 3.0 upgrade. Solvent was released by the Massachusetts Institute of Technology (MIT) quite some time ago, before such measures existed and may never be upgraded to meet these new standards. You can still enable the program by downloading Nightly Tester Tools, a Firefox Add-on that lets you over-ride the security warning. Once Nightly Tester Tools is installed, go to the "Tools" menu and select "Add-ons". You should see a button in the bottom right corner of the pop-up window that says "Override all compatibility."
Click this button, and then re-download Solvent. You should then be able to "Force Install" Solvent in the "Add-ons" window.
Fig 3.1: Once Nightly Tester Tools is Installed you can Force Install Solvent
After Solvent is successfully enabled, you should uninstall Nightly Tester Tools so that you do not accidentally install other programs later that pose a real security risk to your computer. If you are not comfortable with this, search for another program that can generate XPaths; Firebug is another such program, though I find it more difficult to use for our purposes. We will also be learning how to write XPaths manually — though this is more difficult still.
This program will help you find errors in your code. Unlike the other programs, this does not run in your Firefox window. Launch Komodo Edit as you would any other program.
Once you start coding, you can use this program to show you where "syntax" errors appear in the code. Syntax errors are instances where you have not followed JavaScript's rules (think grammar violations).
If you get an error message that says something like "syntax error," or "unterminating literal," you can cut and paste your code into Komodo Edit. Then, under the "View" menu, select "View as Language" > "JavaScript". Just like in MSWord when you make a grammatical mistake, Komodo Edit should point you to the line in your code where you've made a syntax error. For example:
Fig 3.2: Using Komodo Edit to Find Errors
In the case shown above, the error is an extra ")" at the end of the line. By narrowing down where to look, Komodo will save your eyes (and sanity). Don't worry if you can't understand the code yet; you'll learn that soon. Note that the line with the squiggly line under it may not actually be the source of the error. In some cases, it will be the line directly above.
This is all you will be using Komodo for. You may prefer to use Notepad++ (PC only) or another JavaScript syntax-checking program.
Once all five of these programs or their equivalents are installed, you can move on.