Guideline H: Languages with a bidirectional script


Languages with a bidirectional script

Languages such as Arabic, Farsi, Urdu, Hebrew, and Yiddish have their text written from right to left (RTL) and their numbers and embedded segments of western language text written from left to right (LTR). Text flowing from right to left is generally right-justified while text flowing from left to right is generally left-justified. Because of this possible mixture of text segments in two directions, the scripts of these languages are called bidirectional (BiDi or bidi) scripts.

Example of a Mixed Arabic and English Text.means Arabic is a beautiful language

Example of a Mixed Arabic and English Text (Start Reading from the Right)

Example of a Mixed Hebrew and English Text.means Hebrew is a beautiful language

Example of a Mixed Hebrew and English Text (Start Reading from the Right)

Physical and logical sequences

In bidirectional scripts, the characters can be ordered and stored in either physical sequence, where the characters are in the same order as they are presented (on a screen or in print); or logical sequence, where the characters are in the order in which they are entered and pronounced if read aloud.

The logical sequence is the preferred order in which to process bidirectional data in workstation environments because bidirectional text is processed similarly to Latin text. When using logical order in storage, your software (such as the rendering engine of the operating system in the workstation) must provide the means to reverse segments whose direction is opposite to the global orientation. Conversely, the traditional way to enter, store, and process bidirectional text in mainframes is in physical order. Therefore, when integrating bidirectional text from mainframe and workstation environments, you must transform the text to a layout where all the text has the same order.

Example: The string, david is 12 years old., where lowercase characters represent Arabic or Hebrew characters, is presented and stored in different layouts as follows:

Presented on a right-to-left screen: .dlo sraey 12 si divad
Stored in physical sequence: david is 21 years old.
Stored in logical sequence: david is 12 years old.

Bidirectional text processing

Processing of bidirectional text refers to:

- Text entry, where each text segment can possess a different directionality.
- Presentation aspects of bidirectional text:

- Set and query bidirectional attributes. Bidirectional attributes are introduced in Guideline H2 - Respecting the bidirectional attributes.

- Transforming between the different text layouts based on the values of the bidirectional attributes.

This publication discusses the guidelines that will enable your product or application to process bidirectional data.