Free Script for Hebrew or Arabic Text in Regular Version of InDesign

Rachel wrote:

In InDesign I sometimes have to work with small bits of Hebrew text. I work enough with the issue to make Hebrew backward-typing annoying yet not enough to warrant InDesign ME.

I can totally understand this frustration! Some of you may know that back in 2001 I co-authored a book called Judaism For Dummies. Back then I tried for days to figure out how to get the bits of Hebrew we needed into InDesign. Many text editors and word processors, such as Microsoft Word, can handle right-to-left text just fine. But with InDesign, you have long needed to use the ME (middle-eastern) version of the program, developed and published by Winsoft, and available in the United States by FontWorld. (Diane Burns wrote a great article about this in Issue 13 of InDesign Magazine.)
I remember working on the book and discovering that I could copy Hebrew out of MS Word and paste it into PageMaker, and it would retain it’s right-to-left appearance. But this doesn’t work in InDesign for some reason. The ME version is great if you have a lot of Hebrew or Arabic text, but what if you only need to set a word or a phrase? Rachel’s email prompted me to take action: Get a script!

Peter Kahrel was kind enough to write a little script that reverses the order of any selected text. That is, if you select “abcde” and run the script, you get “edcba”. To download the script, right-click on this link and choose Save As (or Save Target As or whatever your browser calls it). If you need to know how to install scripts, click here.

Once you have the script installed, you can run it by double-clicking on it in the Scripts palette, or by assigning a keyboard shortcut to it in Edit > Keyboard Shortcuts (product area: Scripts).

To make this work for Hebrew, you can either type the text backward into InDesign (which isn’t fun) or type it normally into any program that supports right-to-left typing (such as MS Word or TextEdit) then copy that text and paste it into an InDesign text frame. Then select the text and run the script.

But there are (at least) two problems with this workflow. First, some languages (such as Arabic) require ligatures that won’t kick in using this method. Let me know (below) if you have any good solutions for this. Second, these languages read right-to-left, but the first line is always on top. So if you try to convert more than one line of text, the first words will end up on the last line. This is relatively easy to fix with copy and paste.

Here’s an example. (I have no idea what this says; I just copied it from Shlomit Heymann’s InDesign site… someday I really need to learn Hebrew myself.)

Steps from the top:
1. Text copied from Firefox and pasted into InDesign;
2. Hebrew font applied to the text;
3. Script run on the whole text;
4. Set flush right and first three words cut and pasted to first line.

reversetext3

Note that this also (sort of) works if there are nikud (diacritic accents) in the text (top is as copied in, bottom is after the ReverseText.jsx script is run):

reversetext4

I say “sort of” because this text was copied out of an Acrobat PDF file and I can see that one character lost its accent (the third from the right on the bottom should have three dots under it) and the other nikud aren’t always in exactly the correct place. My guess is that the ME version of InDesign handles the character substitution and accent placement better.

Here’s an example that shows how messed up Arabic gets. (Again, forgive me, but I have no idea what this says. I copied off a random Arabic web page.)

reversetext2

So, the lesson of the story is: This may help you with small bits of text, but it ain’t perfect and the more text you have, the more cleanup you should expect to do.

[Editor's note: If you are using CS4, please be sure to see this post for a much better solution!]

Related Articles
Comments

72 Comments on “Free Script for Hebrew or Arabic Text in Regular Version of InDesign

  1. I was SO excited to see this script, because I’m in desparate need of that exact thing right now. However, my problem now seems to be that I’m using CS1 (I do a very small amount of desktop publishing work, and it’s just not worth it for me to upgrade). I keep getting a JavaScript error when I try to run the script. Any ideas? I’m really dreading having to manually reverse the order of over 200 Hebrew words in an article I’m working on, especially since I don’t understand it at all!

  2. Hi all,
    I am using an old version of Indesign, actually first Indesign CS and i have to import in indesign a text and its translation in Hebrew.
    After the import from an unicode txt the Hebrew characters are totally messed because CS1 do not know the right to left rules.

    the scripts do not work, even i put .js

    Indesign ME and other version of CS2, 3 or 4 is out of discussion because i have to work only with CS.

    Do you have any news for me or can you update the scripts for CS?

  3. I got here by googling because i need to edit a book in Spanish and Hebrew in indesign, and i got really happy thinking it would work, but if you look well at the images, you’ll see that the “nekudot” (dots and lines that go under the type and represent vowels) are not placed under the right letters after running the script.

    I hope you can solve that, by now, i’ll have to look for another solution, since this work is really urgent :(

    Thank you very much for developing this anyway!

  4. i was wondering if this script works with CS5?
    please let me know because i am debating between upgrading to ME or the regular indesign and this will make a big difference to me decision.

  5. Pingback: Hebrew backwords | Digitalwalmart

  6. hey, dave, thanks a bunch for this script! wish i had searched for this sooner as i’ve been reverse typing bits of hebrew 1 by 1 like a Complete “genius” haha 8-)

  7. Hello,
    First of all, thank you for this page and the script!
    This script works from right to left but it works to much ! it also reverses from top to bottom.
    I’m using CS6.
    Did you fixed it ? Have you another solution ?

  8. Dear Peter,

    Today, where everybody is trying to converting his/ability into money, you are providing these useful script free of cost.

    Please accept my special thanks from deep of my heart.

    Because of you type of people, we are still feeling responsibility towards society.

    I have also added my all knwloedge free of cost to my website.

    Anyone can download all the training material from following link:
    http://typesettingindia.com/Training.html

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>