Text sorting and direction

Learn about attributes and elements used to adjust text sorting and direction.

Sorting text using the sort-as element

In languages like English, you can easily sort lists by alphabetical order. But it's not that simple in languages such as Japanese and Chinese. This is because the same character can have different pronunciations depending on the meaning.

To specify text that you want to use for sorting, add a sort-as element inside a sorted element:
<glossentry id="gloss-harry-potter">
  <glossterm>&#x30CF;&#x30EA;&#x30FC;&#x30FB;&#x30DD;&#x30C3;&#x30BF;&#x30FC;</glossterm>
  <prolog>
    <sort-as>Harry Potter</sort-as>
  </prolog>
  <glossdef></glossdef>
</glossentry>

Sorting index terms using the index-sort-as element

You can adjust the sorting order of index terms by adding the index-sort-as element:
<indexterm>&#x30CF;&#x30EA;&#x30FC;&#x30FB;&#x30DD;&#x30C3;&#x30BF;&#x30FC;
  <index-sort-as>Harry Potter</index-sort-as>
</indexterm>

Changing text direction using the dir attribute

English and many other languages use left-to-right (LTR) script. But there are many languages like Hebrew or Arabic that use right-to-left (RTL) script. To optimize localization, it's a best practice to specify text direction using the dir attribute:
<map xml:lang="ar-IQ" dir="rtl">
Tip: To set an attribute of an element in oXygen XML Editor, select the element, press Alt + Enter and type the name of the attribute you want to set.
Note: You should apply a new language code and text direction after translation.