Base text direction

Base text direction refers to the order in which directional runs are laid out in a sentence.
For left-to-right sentences, for example, in English, the proper base text direction is Left To Right (LTR), even if a sentence includes Arabic, Hebrew, Urdu, or Farsi words. For right-to-left sentences, for example, in Arabic or Hebrew, the proper base text direction is Right To Left (RTL), even if a sentence includes English words or numbers.
Determining whether a sentence is, for example, English or Arabic, is not always easy. Examine the example sentence in Directional run. This sentence is an Arabic and Hebrew sentence and therefore has a right-to-left base text direction. The directional runs must be laid out on the line one after the other from right to left. The following example shows each directional run enclosed in square brackets.
[.] [united states][ EHT OT TNEW I ,] [23][ SAW I NEHW]
Consecutive English words form a left-to-right directional run even when they are embedded in an Arabic, Hebrew, or Urdu sentence. Consecutive Arabic or Hebrew words form a right-to-left directional run, even when embedded in an English sentence. The ordering of successive directional runs depends on the value of the base text direction.
The natural text direction of a language, right to left for Arabic, Hebrew, or Urdu and left to right for English, is inherent in the script used to write the text and is independent of the component direction, which is handled by the GUI mirroring mode, and of the user locale. Even if the GUI of a product is not mirrored, bidirectional text entered by the user of an application, that is, bidirectional text that the user directly or indirectly introduces and sees through a product’s GUI, should be displayed according to its natural base text direction. The user should have control over document and paragraph base text direction independently of the component direction (GUI mirroring mode).
The base text direction of bidirectional text affects its display. Consider how the string hello world !, listed in logical order, that is, the order in which the text is pronounced, is displayed when its base text direction is changed.
With left-to-right base text direction, the string is displayed:
hello world !
With right-to-left base text direction, the same string is displayed:
! hello world
In the example of right-to-left base text direction the exclamation mark (!) appears on the left side of the string.
The string is not displayed as “! world hello” when the base text direction is right to left. Even though the base text direction is right to left, consecutive English words always constitute a left-to-right directional run, so that each word is displayed left to right and the progression of words in the run is also left to right.