Monday, March 26, 2007


Bidirectional Support FAQ

Here on the Platform team we have had a series of questions about how the bidirectional support in Eclipse works and I thought it was time I blogged about it. Here are some commonly asked questions:

1) What is the difference between using -dir rtl and -nl iw?

-dir rtl was a command line parameter that Help was using before the workbench added it's general BIDI support in 3.1. When we added the BIDI support ourselves we continued to support the old flag but we also felt that the -nl command line parameter made more sense. If you are using a Arabic, Farsi, Hebrew or Urdu locale as the argument to the -nl parameter you will get right to left support.

The TextProcessor does not support the -dir rtl parameter so it is recommended that you use the -nl parameter to get all of the bidi support. Note that TextProcessor will process BIDI strings whenever the Locale is bidirectional whether or not the Locale was set by -nl or taken from the OS.

So if you use -dir rtl your orientation will be set to right to left but your paths etc. will not use the text processing.

2) What is the difference between TextProcessor and Window#getDefaultOrientation ?

TextProcessor is a class supplied by OSGi to used to process strings that have special semantic meaning (such as file paths) in RTL-oriented locales so that they render in a way that does not corrupt the semantic meaning of the string but also maintains compliance with the Unicode BiDi algorithm of rendering Bidirectional text. (from the javadoc).

So for instance will render the entire String in left to right order but will process each segment right to left.

org.eclipse.jface.Window#getDefaultOrientation is a method used to determine the default orientation for windows. If it is not set the default value will be unspecified (SWT#NONE) (also from the javadoc).

Dialogs, Windows, IWorkbenchParts
and FormToolkits use this value to determine their default orientation. All of these classes allow the orientation to be overridden.

3) Why do I not get bidirectional text processing in left to right orientations?

Using the TextProcessor to evaluate paths is slower than not processing them at all (of course). For performance reasons we do not use
TextProcessor unless you are in a bidirectional Locale.

4) How do I set my inputs to use bidirectional support?

All input processing is done using the platform widgets. Eclipse generally does not try and work differently than the OS so we use the OS input methods.

5) What happens if I use multiple direction parameters?

There is a precedence of these parameters. As document in the help at org.eclipse.platform.doc.isv/reference/misc/bidi.html:

The orientation of the workbench is determined in one of the following ways (in order of priority):

The TextProcessor is only checking Locale and does not use this precedence.


6) Is right to left ever the default?
No. When we initially did this work we made right to left the default for users in the right to left locales but the overwhelming response was that they developed in left to right and then we should only switch orientation if explicitly asked to.

So if you start Eclipse on an Urdu machine with no command line arguments you will get left to right orientation. If you start Eclipse using the command line argument -nl ur on the same machine you will get right to left orientation.

7) Who uses this support?
This is actually a question for you. We know there are lots of users who use Eclipse left to right in a right to left locale but we are interesting in hearing from
If you are one of these people please log a bug to Bugzilla or add a comment to this blog.
Thanks for posting, this was confusing as hell before. Could this even end up in the documentation formally somehow?
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?