Internationalization Topics

Bi-Directional Text Processing

Scripts like Hebrew and Arabic are bi-directional, starting from right-to-left, but containing left-to-right elements. Arabic numbers (i.e. Western numbers) are written left-to-right. For example, the following sentence is written in left-to-right:

This is right-to-left text with the number 1948 as left-to-right.

But as bi-directional text adhering to Hebrew and Arabic rules:

.thgir-ot-tfel sa 1948 rebmun eht htiw txet tfel-ot-thgir si sihT

Notice how the numbers change direction compared to the rest of the characters. Arabic and Hebrew texts are also right-justified.

Many programming languages offer support for bi-directional text processing and display. A thorough review of the application code and user interface portion of the source code is advised before reengineering for bi-directionality.

HTML

HTML implements bi-directionality using a BDO tag:

<BDO LANG=en DIR=rtl>The direction of these 345 lines is right-to-left.</BDO>

Displays the following text:

.tfel-ot-thgir si senil 345 eseht fo noitcerid ehT

The BDO element overrides the bi-directional algorithm for enclosed text. Characters in Unicode are assigned a directionality, left-to-right or right-to-left, to allow the text to be rendered properly. Many other tags also accept the "DIR" attribute. For an exhaustive write-up, please see the HTML 4.0 specification.