Best Practices- using the direction tag when using bi-directional text

You are using bi-directional text for example if your topic in Farsi contains an excerpt in English. You should use the DITA dir attribute to tag the exceptional content to indicate the correct the text direction.

About this task

The dir attribute is a DITA attribute for influencing the direction in which your text is rendered. The Reference Implementation is designed to handle both languages that are read from left to right, such as English and other languages that are read from right to left, such as Hebrew and Arabic.

This task explains how you can ensure that text in both directions is rendered properly by the Reference Implementation. You do so by indicating that text direction of the exceptional content with the DITA attribute dir. For example your topic is written in Farsi, with an excerpt in English. You should tag the English language content with the dir="ltr" so that the Reference Implementation will render the excerpt correctly from left to right, while the rest of the page is rendered from right to left.

Procedure

  1. Check out the topic from Content Manager with an XML editor such as Content Editor.
  2. Check which direction your topic language is read, either from right to left or from left to right and tag the direction of the exceptional content. Reference Implementation renders the topic as determined by the language setting for the topic.
    • If the main topic is written in a right to left language, such as Farsi (fa), then the exceptional content in a left to right language, such as English, should be tagged with the dir="ltr" attribute.
    • If the main topic is written in a left to right language, such as English, then the exceptional content in a right to left language, such as Hebrew (iw) should be tagged with the dir="rtl" attribute.
  3. Check in the topic to save your changes.
  4. Republish your publication to verify your changes appear on the page in the Reference Implementation.

Results

Using the html dir attribute ensures that your excerpts are aligned and rendered in the direction that you assigned to the dir attribute.