What considerations should be made for bi-directional (BiDi) text in DITA localization?

When localizing DITA content for languages that require bi-directional (BiDi) text, such as Arabic and Hebrew, several important considerations need to be taken into account to ensure the correct display and readability of the content. Here are some key factors:

Text Direction

BiDi languages have both left-to-right (LTR) and right-to-left (RTL) text within the same document. DITA allows specifying the text direction at various levels, including the document or specific elements. This ensures that BiDi text flows correctly, maintaining the logical order of words and characters.

BiDi Control Characters

Using Unicode control characters is essential for handling BiDi text. DITA provides the flexibility to include these control characters within the content, such as the Right-to-Left Mark (RLM) and Left-to-Right Mark (LRM). These characters help manage the mixing of LTR and RTL text segments and maintain the intended display order.

Styles and Formatting

Proper styling is crucial for BiDi text. DITA allows for the definition of specific CSS styles to control text alignment, margins, and line height for RTL and LTR segments. Additionally, handling aspects like text justification, list formatting, and tables in a BiDi context requires careful styling and formatting to ensure a harmonious layout.

Example:

Here’s an example of how DITA allows for specifying text direction and including BiDi control characters:


<topic id="bidi_content" language="ar">
  <title>Bi-Directional Text</title>
  <text-direction>auto</text-direction>
  <content>
    <p>This is an example of Bi-Directional text: اهتمام RTL and LTR تجربة.

</content>

In this example, the DITA topic is localized for Arabic with automatic text direction. The text content contains both RTL and LTR segments, and Unicode control characters are used to ensure correct display order.