Hamid Fadishei's Blog

January 29, 2012

Adding RTL (Right-to-Left) Support to Zotero

Filed under: Research,Uncategorized — fadishei @ 3:09 am
Tags: , , , , ,

Update (2012-08-16): I’ve patched the Zotero source and posted a pull request on github. I asked Zotero developers to add this feature to the main distribution. Please support it by asking the Zotero developers to merge the pull request via email or forum.

Pull request page: https://github.com/zotero/zotero/pull/157
Related forum post: http://forums.zotero.org/discussion/10879

In a previous post, I wrote about Zotero and the lack for supporting RTL languages in its note editor and how to work around this problem. In this post a better procedure for adding RTL support to Zotero is presented that also works in newer versions of Firefox.
The procedure is similar to the previous post with one difference: This time, you modify the Zotero plugin before installing it in Firefox.

mkdir ~/work
cd ~/work
wget http://download.zotero.org/extension/zotero-2.1.10.xpi
unzip -d xpi zotero-2.1.10.xpi
mkdir jar
cd jar
jar -xf ../xpi/chrome/zotero.jar
cd ..
wget http://downloads.sourceforge.net/project/tinymce/TinyMCE/3.3.9.2/tinymce_3_3_9_2.zip
unzip tinymce_3_3_9_2.zip
cp -au tinymce/jscripts/tiny_mce/* jar/content/zotero/tinymce/
sed -i 's/paste,contextmenu/paste,contextmenu,directionality/g' jar/content/zotero/tinymce/note.html
sed -i 's/sup,|,forecolor/sup,|,ltr,rtl,|,forecolor/g' jar/content/zotero/tinymce/note.html
cd jar
jar -c0f ../xpi/chrome/zotero.jar *
cd ../xpi
zip -r ../zotero-2.1.10-rtl.xpi *

The above procedure worked for me on Zotero 2.1.10 and Firefox 9.0.1.
The version of TinyMCE that should be downloaded can be determined by inspecting the file jar/content/zotero/tinymce/tiny_mce.js before downloading it.

February 25, 2011

Writing RTL Notes on Zotero

Filed under: Research — fadishei @ 10:45 am
Tags: , , , , ,

Update (2012-08-16): I’ve patched the Zotero source and posted a pull request on github. I asked Zotero developers to add this feature to the main distribution. Please support it by asking the Zotero developers to merge the pull request via email or forum.

Pull request page: https://github.com/zotero/zotero/pull/157
Related forum post: http://forums.zotero.org/discussion/10879

Update: The procedure in this post does not work on new Firefox versions as it disables plugins which are modified after installation. For an updated and better procedure, please visit here.

Zotero is the software for researchers and in my opinion, it is a must. It helps you organize your references, add tags and notes to them, search them, and do a lot more things. The first day that I met this research tool, I said to myself: “The water is in the jug and I am looking for it around the world”! (This is a Persian idiom, which is used when you find out something you really missed was in fact near you).

As a Persian native, one thing that zotero lacked for me was the support of RTL languages in its note editor. After some goolging and reading a useful post on the Zotero forum, I managed to add the RTL and LTR buttons to its built-in editor. If you need the support of RTL languages (such as Arabic, Hebrew, and Persian) in Zotero then this blog post may help you. I hope that Zotero team will add this functionality to the main zotero release so that RTL people do not have to patch their installation for it.

The procedure is for the latest stable release at the moment which is zotero-2.0.9. I assume that you have Zotero installed and my instructions are for a Linux environment. You should patch the RTL functionality into built-in tinyMCE editor which resides in zotero.jar.

First of all, make a working directory and find and unpack zotero.jar there:

$ mkdir -p ~/work/zotero
$ cd ~/.mozilla
$ find -name zotero.jar
./firefox/z4qwdrwe.default/extensions/zotero@chnm.gmu.edu/chrome/zotero.jar
$ cp ./firefox/z4qwdrwe.default/extensions/zotero@chnm.gmu.edu/chrome/zotero.jar ~/work/
$ cd ~/work/zotero
$ jar -xf ../zotero.jar

Then you should download the same version of tinyMCE as the one in zotero.jar and add the extra tinyMCE files that are not available in the zotero.jar to it. In order to find out what version it is you can look at tiny_mce.js.

$ cat content/zotero/tinymce/tiny_mce.js | grep Version
   majorVersion : '3',
   minorVersion : '3.9.2',
$ cd ..
$ wget http://downloads.sourceforge.net/project/tinymce/TinyMCE/3.3.9.2/tinymce_3_3_9_2.zip
$ unzip tinymce_3_3_9_2.zip
$ cp -au tinymce/jscripts/tiny_mce/* zotero/content/zotero/tinymce/

The third step is to enable directionality plugin. Go this way:

$ cd zotero
$ vi content/zotero/tinymce/note.html
change:
    plugins : "paste,contextmenu",
to:
    plugins : "paste,contextmenu,directionality",

change:
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,forecolor,backcolor,|,blockquote,|,link,unlink",
to:
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,ltr,rtl,|,forecolor,backcolor,|,blockquote,|,link,unlink",

Now you can compress your new zotero.jar and move it back into where you found it in the first step:

$ jar -cf zotero.jar *
$ mv zotero.jar ~/.mozilla/firefox/z4qwdrwe.default/extensions/zotero@chnm.gmu.edu/chrome/

You should (re)start your firefox now. If everything goes OK, you will have two new buttons in your browser: RTL and LTR.

Blog at WordPress.com.