Saturday, September 10, 2011

How to force babelfish firefox plugin compatibility [for Mac]

So because of the stupid rapid release schedule of Mozilla many addons seem to break after a firefox update.
However we are thankful for the addons being open source and simply xml/javascript code which we can hack around.
I'll describe this for Mac Users.
Basically every addon ships with two parameters which is the minimum and maximum firefox version required in order for it to work. That variable is not detected automagically and is just selected by the developer of the plugin. For Babelfish 1.9.6 the maximum version is set to 5.*
Changing this to the latest will suffice.

So first step is to find the Firefox Extensions Directory:
  1. If you don't see a library folder within your home directory :
    Open up a terminal and run : chflags nohidden ~/Library
    That will unhide the Library folder (at least for Lion it is needed)
  2. So now go to your home directory and open the Library folder.
  3. Find the Application Support folder within.
  4. Find the firefox folder within (not the mozilla one!)
  5. Open the Profiles folder within the firefox folder and somehow find your own profile-directory and open it (hopefully there's only one)
  6. Behold the directory called extensions.
Now comes the hacking part. An extension can either have a directory structure (be a directory) or be a zipped file of a directory. In either way it will most probably have a very weird naWithme.

In this case the babelfish plugin is a directory. If you see many directories open them one by one and right-click their chrome.manifest file within. On the menu go to Open With and select Text Edit or another editor. In the correct directory of babelfish the manifest file will start with the words: "content babelmousish".

Ok so now you've found the plugin directory. Within that same directory you'll also find a file called install.rdf
That file is xml encoded which is also plaintext. So again right click open with a text editor and go to line 12.
In that line change 5.* to the latest.
Save the file and restart firefox. Babelfish should now be compatible with the latest version of firefox.

Just for the record if the plugin was to be an xpi file we would unzip it with a compression program, change the rdf file, store it, zip it again and rename it back to xpi replacing the older one.