Desktop Applications for Bidirectional Languages

Uniface supports bidirectional languages such as Arabic and Hebrew, which are read from right-to-left (RTL), and enables you to design and create applications for such languages. Although you need to develop the application on a left-to-right (LTR) system, you can run, test, and deploy on both LTR and RTL systems.

The Uniface IDE is a left-to-right application and it applies that orientation in the Form editor. Right-to-left direction is applied only in the runtime environment.

You can configure the application to run as a right-to-left application, even on a left-to-right Windows systems. If you only need to have selected forms or fields read from right-to-left, you can specify that in the form or field definition.

Configuring a Right-to-Left Application

To have an application read from right to left, add the setting $RTL_APPLICATION to the application's assignment file. This has the following consequences:

  • The layout of the application shell, and all forms and menus in the application is mirrored, so the starting point is on the right instead of the left.
  • Widget controls and scroll bars are mirrored. For example, the arrow in a drop-down menu is located on the left instead of the right.
  • Labels that are left aligned or right aligned are mirrored.
  • The language direction reads from right to left.
  • The default cursor position for fields is on the right instead of the left.
  • Arrow keys, Home, and End keys follow the native language direction.
  • Widgets and frames that are attached to the left or right window border are attached to opposite side. Thus, if its Attach to Window Border (Attach) property is set to Right, a field is attached to the left in an RTL application.

Application is mirrored when $RTL_APPLICATION is present in assignment file
Application reading from right to left Hebrew text)

For more information, see $RTL_APPLICATION. Other assignment settings can be used to control the position of the cursor and print processing in RTL applications. For more information, see $RTL_FIELDS and $RTL_PRINTING.

Defining the Direction of Specific Forms or Fields

If you only need to define the reading direction of selected forms or individual fields, you can set the direction in the form's Window Properties or the field's Field Layout.

The direction of a form overrides the $RTL_APPLICATION setting, so if you explicitly set the direction of a form as left-to-right, and run it in a right-to-left application, the LTR orientation is applied.

Similarly, if you set the layout direction of a field, it overrides the value of the $RTL_FIELDS assignment setting.

LTR Application with Some RTL Forms

Consider a left-to-right form that uses a contained form widget to display text from different languages. Depending on the language selected, a contained form with the Direction set to Right-to-left can be used for RTL languages. The only difference between the contained forms in the following illustrations are the Direction property and background color of the forms.

Form with contained form for LTR language
Left-to-right form with contained form for LTR language

Form with contained form for RTL language
Left-to-right form with contained form for RTL language

Widgets and Labels

Widgets and labels are mirrored when the direction is right-to-left.

The alignment of text on Uniface and header command buttons is also mirrored. (On normal Windows buttons, it is always centered.)

The OCX container widget is always displayed as LTR (Left to Right) regardless of the environment and the reading direction.

Testing and Debugging RTL Applications and Forms

To test RTL forms and applications, you need to create an application shell and run it with an assignment file that contains the $RTL_APPLICATION setting.

For example, the following command runs an RTL app:

"D:\Uniface 10.3.02\common\bin\uniface.exe" /asn="D:\unifaceData\10302\project\rtl.asn" RTL_APP

The assignment file used contains only the following:

;RTL assignment file

[SETTINGS]

$RTL_APPLICATION

[RESOURCES]


D:\unifaceData\10302\project\resources\

[DRIVER_SETTINGS]
SLE     U1.0
USYS$SLE_PARAMS create db = on, identifiers = quoted

[PATHS]
$DBMS_DEF    SLE:D:\unifaceData\10302\project\dbms\userdata.db
$DEF    $DBMS_DEF

Note: It is not possible to properly test RTL forms using the Compile & Test option or the /tst command line switch.

To debug the application, you can use the Uniface Debugger. Like the Uniface IDE, the Uniface Debugger is a left-to-right application, so the direction of debug windows is always left-to-right, even when debugging an RTL application.

Compatibility

Prior to Uniface 9.6, entities, fields, and area frames that were attached to the left or right window border (or split bar) remained attached to that side, even when running right-to-left.

For existing RTL applications that rely on absolute positioning of the object's Attach to Window Border (Attach) property, a compatibility setting is provided. To prevent attached objects from being mirrored in an RTL application, you can set RtlAttachMirroring to false. For more information, see RtlAttachMirroring.