Whether your application should display its content in RTL should be based on the content

A customer had the following puzzle:

We have a small bootstrapper application that consists of a dialog box and a few message boxes. The problem is that we want our application to work properly on Arabic and Hebrew systems, and we can't come up with a good way to determine text direction of the underlying system. We found this article by Michael Kaplan that tells us how not to do it, which is great, but what's the recommended way of actually doing it?

You already know whether you should be displaying your application's UI in LTR or RTL: If this is the Arabic-localized or Hebrew-localized version of your application, then display it as RTL. If this is the English-localized or French-localized version, then display it as LTR.

There's no point in trying to display your English-language strings in RTL just because the underlying operating system is Arabic. If your strings are in English, then display them in the way they should look to an English speaker. A dialog box like this helps nobody:

...Please wait ×
,(Preparing setup (50% complete
.your patience is appreciated

When your localization team translates the application into Arabic, they can insert two copies of U+200E (LEFT-TO-RIGHT MARK) at the start of the File­Description in the version resource. That is the signal to Windows that the application should have RTL as its default layout direction.

If you want your application to choose a language dynamically (say, to use English strings if running on an English system but Arabic strings if running on an Arabic system), then you can add a flag in your resources so that the localizers can indicate whether a particular language pack expects text to run left-to-right or right-to-left.

IDS_LANGUAGE_DIRECTION "LTR" // change to RTL if localized in Arabic, etc.

Your application could then check the direction and call Set­Process­Default­Layout based on the result.

Comments (15)
  1. MGetz says:

    On a side note… the link to Michael Kaplan's blog is broken externally right now. His blog is not available outside Microsoft at the moment.

  2. Brian_EE says:

    Bing has a cached copy of the page: cc.bingj.com/cache.aspx

  3. Jeff says:

    Except if you have one app that can dynamically load localized strings.

    You answered a question, just not the one they asked.

    [It was lost in my distillation, but the reason they wanted to know the default text direction of the underlying OS is that they wanted to show their dialog boxes in the same direction. My point is that the direction of the dialog boxes should match the contents of the dialog boxes. (And the second half of my answer addresses the dynamically-loaded strings issue.) -Raymond]
  4. Random User 058372 says:

    /me just had the (completely unsurprising but) amusing thought that, when read right-to-left, "LTR" is "right-to-left".

  5. Mr Cranky says:

    @Random User 058372: Good point!  "RTL" can only mean the "wrong" way.  All languages are "LTR" as far as they are concerned.  A better convention might be to use ">" and "<".

    I'm confused by the example.  Shouldn't it be something like:

        …tiaw esaelP

    .etelpmoc %05 puteS


  6. Random832 says:

    Does the close button always display on the right side of LTR windows and the left side of RTL windows, or is it always on the right on an LTR OS and left on an RTL OS?

  7. Random User 058372 says:

    Mr Cranky,

    To my (extremely limited) knowledge of foreign languages, most RTL languages use syllablries, not alphabets, and "normal" arabic numbering. So I would guess closer to:

             …wait Please

    .pleatcom %50 upSet

    (Your opinion of syllable breaks my vary.)

    Initialisms being special cases, because the order of the letters is dependent upon the order of the words being represented.

  8. Gabe says:

    Random User 058372: Syllabaries are quite rare. Probably the only common ones are Hiragana and Katakana (both Japanese), and they are LTR. Arabic, Hebrew, and Urdu are the most common RTL scripts.

  9. Random User 058372 says:

    My mistake. Extremely limited, confirmed. Don't mind me.

  10. Hiroshi says:


    > Probably the only common ones are Hiragana and Katakana (both Japanese), and they are LTR.

    Only due to computer restrictions.

    For over a millennium, Japanese (include hiragana, katakana, and han scripts) is written from top-to-bottom and right-to-left.

    This is still true in most published works, such as novels and newspapers.

    The fact that PCs do not display text in this layout is a large barrier for older Japanese.


    Tokyo, Japan.

  11. hacksoncode says:

    I'm a bit confused… the linked article (thanks for the bing cache BrianEE) *does* contain a suggestion for the best way to do it. Why did he say that it doesn't?

  12. Neil says:

    Any particular reason you wrote …Please wait instead of just adding dir="rtl" to the table? (Naturally if I now add dir="rtl" to the DOM the browser "corrects" the text.)

    [So that it also looks wrong in a screen reader. (Don't forget accessibility!) -Raymond]
  13. Boris says:

    @Christian: see his Twitter account. He merely mentioned a planned meeting with the potential to restore the blog, and later noted that we shouldn't expect its return in the near future. If the blog is available from inside Microsoft, obviously it's not a technical issue; anything more would be speculation.

  14. @Random832: It is a known fact that humans have mixed preferences. For instance, not every right-handed person necessarily prefers to shoot with right hand, kick with the right foot, sit in a car with the driver's seat on the right side, drive in the right lane or sit on the starboard side of a ship. The same way, not every RTL language writer might prefer the Start button or Office button on the right side of the screen.

    Software developers either fail to account for all these permutation or fail to keep up with the deadline, the budget and these permutations at the same time. They make a compromise somewhere. 90/10 law, you know.

  15. Christian says:

    Does anybody know *why* Michael Kaplan's blog is not available?

    [Why not ask him? If he wants to say, he will say. If he doesn't want to say, he won't say. I don't know why, but even if I did, I wouldn't tell you because it's not my story to break. (I think people are missing this basic courtesy.) -Raymond]

Comments are closed.

Skip to main content