Text and Localization in the EUI
Text that appears throughout the EUI is controlled by the macro
$ewText.get() and a set of variables in the translation.properties record.
$ewText.get(“key”) finds the appropriate translation.properties file based on the user’s session locale. In the translation.properties file, each “key” is associated with a text string, and the
$ewText.get macro substitutes this value in the page.
For instance, the home page contains the following link:
The link’s text is defined by the
home.hc.new.link variable in the appropriate translation file, for instance, “Create a Helpdesk Case” for English or “Создать запрос” for Russian.
In translation.properties, the text keys begin with
Changing Text in the Interface
To alter the text in a template page...
- Open the applicable template to find the name of the variable that defines the text you want to change.
- Open the
translation.propertiestemplate and find the variable, then edit the text that follows the equals sign (=).
Text variables are organized by function (home page, menu, title bar) and then by table to help you determine which variables apply to which text based on the variable name.
Why not enter text directly in page templates?
You might feel that substituting variables is a rather indirect way to manage text on the page, and indeed it would be simpler to edit text directly on the various pages. There is nothing to prevent you from bypassing the
$ewText.get macro and simply entering text directly into the EUI Template pages if you want to.
There are two main reasons the interface uses variables for text:
- Support for multiple language usage. By using variables, the admin can create a full translation of the end user interface by simply copying the translation.properties template to a new one with a different language attached, e.g. translation_fr.properties. The text values in that file can then be translated so that someone logging in to the program with the French locale will see the translated French text values.
- Consistency and ease of changes. It is easier to make a consistent terminology change when the text variables are separated into a single file. Each home page variant references the same set of text variables. By using the same variables in each home page, if you decide to change the name of a table, for instance, from Support Cases to Support Tickets, you can go to the translation templates and make all the terminology changes across the board in one place.
Localization with ewText.get
The purpose of the
$ewText.get() method is to allow for a multilingual environment. The method
#ewtText.get($key) works together with another EUI template,
translation.properties. Translation.properties is actually a family of templates; the default
Agiloft setup includes several localization files such as
translation.zh.properties which hold Russian and Chinese text respectively. For more information, see Localization.
The file translation.properties is used when no locale is set for the user's session. This is initially in English, but you could choose to use a different default locale/language.
Each row of
translation.properties consists of a key/value pair, in the form
home.1table.title=Welcome to the Agiloft custom portal.
In this case,
home.1table.title is the key, and the value is the text "Welcome to the Agiloft custom portal".
The $ewText.get($key) method checks each user's session locale and uses that to determine which translation_xx.properties file to use. Setting the session locale can be done in a number of ways.
- One possibility is to set the locale in the login link using lang=XX.
- Another is to use the #ew_languages macro to display a list of available languages for the user.
For more information on Agiloft's localization-related macros, see EUI Macro Reference.
Let's add a new key/value pair to translation.properties. Bear in mind that in a multilingual environment, the key and its translated value must be added to each translation template file.
Open translation.properties from the EUI Templates table and add the following line of text under
#These variables provide the text on the home pages:
- Click Save.
- Now open new_task.html and make the following changes in the Body field:
- Within the <title> tags, replace register.title with newtask.title.
- Within the <h2> tags, replace
Create a Task.
- Save the record, log back into the EUI, and note the changes.