Skip to main content

One template for Arabic and English

Use one template for users who run the program in Arabic and users who run it in English. The texts change with the language of the program. The direction of the page does not change. The example uses the Invoice document type.

Before you begin​

  • Open the designer from a saved invoice, on a template you may change. See Design an advanced report.
  • GetLanguage() returns the language the program runs in, as a short code such as ar or en. It is the language of the user who prints, not of the document.
  • The invoice data has the two names of a material: Material_Name and Material_LatinName. The customer and the branch have a Latin name as well.

Steps​

  1. Select the cell that prints the material name. Both fields come from the "Bill Items" table. In the Expressions tab of the Properties panel, set Text to:

    Iif(GetLanguage() == 'ar' Or IsNullOrEmpty([Material_LatinName]), [Material_Name], [Material_LatinName])

    An Arabic user sees the Arabic name. Any other user sees the Latin name, and the Arabic name when the Latin one is empty.

  2. For a fixed caption, such as the header of a column, enter both texts in the expression. For example: Iif(GetLanguage() == 'ar', 'الإجمالي', 'Total').

  3. Check the template in each language. Sign in to the program in the other language and preview the same invoice.

  4. Click Save.

Result​

The same template prints Mineral Water for a user in English and the Arabic name of the material for a user in Arabic. The captions you wrote with GetLanguage() change with them.

The direction is saved once for the whole template, in the Save As window, and changes later with Edit in the management window. See Build an Arabic right-to-left template. So one template cannot print from right to left for Arabic users and from left to right for English users. If the layouts must differ, keep two templates and choose the one you need in the Print window, which saves it as your default for that window. See Template storage, sharing and defaults.

If something goes wrong​

SituationWhy it happensWhat to do
Everyone sees the Arabic text.The condition compares with a different code.Check the code the function returns by printing GetLanguage() in a label.
The Latin column is empty.The material has no Latin name.Keep the fallback to Material_Name, as in the example.
English text looks mirrored.The template is saved as right to left.Use a separate template for left to right.

This page applies to alameen ERP 10, version 10.1.79.764.