Supported Text Types

Out-of-the-box we include support for the following text types:

Developers can add custom text type by contributing to the org.eclipse.equinox.bidi.bidiTypes extension point.

Unless specified otherwise, we assume that the relative progression of the tokens and separators for display should always be from left to right, while the text of each token will go LTR or RTL depending on its content and according to the Unicode Bidirectional Algorithm.

 

Property File

Pattern

[variable name] = [value]

Note: variable names must not include equal signs.

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   PRIORITY=5
   Display (without LRM):         5=YTIROIRP
   Logical order (with LRM):      PRIORITY@=5
   Display (without LRM):         YTIROIRP=5

Compound Name

Pattern

[first part] _ [second part] _ [third part]

Note: name parts must not include underscores.

Detailed Design

The general algorithm applies, with the following adaptation:

Example:
   Logical order (without LRM):   MYPACKAGE_MYPROGRAM
   Display (without LRM):         MARGORPYM_EGAKCAPYM
   Logical order (with LRM):      MYPACKAGE@_MYPROGRAM
   Display (without LRM):         EGAKCAPYM_MARGORPYM

Comma-delimited List

Pattern

[first list item] , [second list item] , . . . , [last list item]

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   ABC,DE,FGH
   Display (without LRM):         HGF,ED,CBA
   Logical order (with LRM):      ABC@,DE@,FGH
   Display (without LRM):         CBA,ED,HGF

System, Userid Specification

Pattern

[system ID] ( [user ID] )

Note: the system ID must not include parentheses.

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   MY_HOST(MY_USERID)
   Display (without LRM):         DIRESU_YM)TSOH_YM)
   Logical order (with LRM):      MY_HOST@(MY_USERID)
   Display (without LRM):         TSOH_YM(DIRESU_YM)

Full Path - Relative Path - File Name

Patterns

Windows full path: [drive letter]:\ [sub-path] \ . . . \ [sub-path]

Windows relative path: [sub-path] \ . . . \ [sub-path]

Windows full file path: [drive letter]:\ [sub-path] \ . . . \ [sub-path] \ [file name] . [extension]

Windows relative file path: [sub-path] \ . . . \ [sub-path] \ [file name] . [extension]

Linux full path: / [sub-path] / . . . / [sub-path]

Linux relative path: [sub-path] / . . . / [sub-path]

Linux full file path: / [sub-path] / . . . / [sub-path] / [file name] . [extension]

Linux relative file path: [sub-path] / . . . / [sub-path] / [file name] . [extension]

Detailed Design

The general algorithm applies, with the following adaptation:

Example:
   Logical order (without LRM):   c:\DIR1\DIR2\MYFILE.ext
   Display (without LRM):         c:\ELIFYM\2RID\1RID.ext
   Logical order (with LRM):      c:\DIR1@\DIR2@\MYFILE.ext
   Display (without LRM):         c:\1RID\2RID\ELIFYM.ext

URL, URI, IRI

Patterns

http:// [domain label] . . . . . [domain label]

http:// [domain label] . . . . . [domain label] / [sub-path] / . . . / [sub-path] / [file name] . [extension]

http:// [domain label] . . . . . [domain label] / [sub-path] / . . . / [sub-path] / [file name] . [extension] # [local reference]

http:// [domain label] . . . . . [domain label] / [sub-path] / . . . / [sub-path] / [file name] . [extension] ? [key1] = [value1] & [key2] = [value2]

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   www.DOC.MYDOMAIN.com\HEB\LESSON1.html
   Display (without LRM):         www.NIAMODYM.COD.com\1NOSSEL\BEH.html
   Logical order (with LRM):      www.DOC@.MYDOMAIN.com\HEB@\LESSON1.html
   Display (without LRM):         www.COD.NIAMODYM.com\BEH\1NOSSEL.html

Mathematical Formula

Requirement

Preserve the relative order of the formula components according to the base text direction of the formula.

Detailed Design

The general algorithm applies, with the following adaptations:

Example (Hebrew):
   Logical order (without LRM):   PROFIT = REVENUE - COST
   Display (without LRM):         TSOC - EUNEVER = TIFORP
   Logical order (with LRM):      PROFIT @= REVENUE @- COST
   Display (without LRM):         TIFORP = EUNEVER - TSOC
Example (Arabic, ampersand represents RLM):
   Logical order (without LRM):   DIVIDEND = SHARE x 0.10
   Display (without LRM):         x 0.10 ERAHS = DNEDIVID
   Logical order (with LRM):      DIVIDEND = SHARE x& 0.10
   Display (without LRM):         0.10 x ERAHS = DNEDIVID

Regular Expression

Requirement

Preserve the relative order of the regular expression components identical to the order in which they appear when exclusively Latin characters are used.

Detailed Design

The general algorithm applies, with the following adaptations:

Example (Hebrew):
   Logical order (without LRM):   ABC(?'DEF'GHI
   Display (without LRM):         IHG'FED'?(CBA
   Logical order (with LRM):      A@B@C@(?'DEF'@G@H@I
   Display (without LRM):         ABC(?'FED'GHI
Example (Arabic):
   Logical order (without LRM):   ABC(?'DEF'GHI
   Display (without LRM):         IHG'FED'?(CBA
   Logical order (with LRM):      ABC(?'DEF'GHI
   Display (without LRM):         IHG'FED'?(CBA

Java Code

Requirement

We can classify elements of a Java program as:

The requirement is to make the relative order of elements left-to-right, while each element by itself will be presented according to the Unicode Bidirectional Algorithm.

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   A = /*B+C*/ D;
   Display (without LRM):         D /*C+B*/ = A;
   Logical order (with LRM):      A@ = /*B+C@*/ D;
   Display (without LRM):         A = /*C+B*/ D;

XPath

Patterns

/ book / chapter / paragraph

/ year / month [@name = "April"]

Detailed Design

The general algorithm applies, with the following adaptations:

Example:
   Logical order (without LRM):   DEF!GHI 'A!B'=JK
   Display (without LRM):         KJ='B!A' IHG!FED
   Logical order (with LRM):      DEF@!GHI@ 'A!B'@=JK
   Display (without LRM):         FED!IHG 'B!A'=KJ

Message with Placeholders

Products often use template messages where placeholders are replaced by custom data at run time.

Requirement

The display considerations must ensure correct presentation of both the template text and the custom data replacing the placeholders, taking in account that these data might have an internal structure, which should be preserved.

Detailed Design

  1. The message template will be considered as having a LTR base direction if it is not translated, a RTL base direction if it is translated to Arabic or Hebrew.
  2. Let us call "insertion unit" a piece of custom data which is to replace a placeholder. Insertion units with an internal structure also have a defined base direction, generally LTR. For insertion units without internal structure, their base direction will be defined as RTL if they contain at least one Arabic or Hebrew letter, LTR otherwise.
  3.  Each insertion unit with an internal structure must be processed according to its specific structure.
  4. If the base direction of an insertion unit is the same as that of the template, there is nothing more to do for it.
  5. If the base direction of the template is LTR and the base direction of an insertion unit is RTL, the insertion unit should have RLE+RLM added at its beginning and RLM+PDF added at its end.
  6. If the base direction of the template is RTL and the base direction of an insertion unit is LTR, the insertion unit should have LRE+LRM added at its beginning and LRM+PDF added at its end.
  7. If the component in which the formatted message is displayed has an orientation different from the template direction, the formatted message must have LRE+LRM added to its beginning and LRM+PDF added to its end if its base direction is LTR, RLE+RLM added to its beginning and RLM+PDF added to its end if its base direction is RTL.
Example (">" represents LRE, "^" represents PDF, "@" represents LRM):
   Logical order (template without LRM):   err012: FILE "%1" NOT FOUND!
   Logical order (%1 without LRM):         c:\DIR1\MYFILE.ext
   Display (without LRM):                  !DNUOF TON "ext.ELIFYM\1RID\:c" ELIF :err012
   Logical order (with LRM):               err012: FILE ">@c:\DIR1@\MYFILE.ext@^" NOT FOUND!
   Display (without LRM):                  !DNUOF TON "c:\1RID\ELIFYM.ext" ELIF :err012