Writing Multi Language Layouts

When defining properties of controls inside a layout definition, there are always two options to specify fix labels: either use property name or property textid. In case your pages support multi language ability, you only have to use the textid property. At runtime, the corresponding labels are found in the following way:

  • Each PAGE has the property translationreference. This property may be the name of the HTML file - or it may be a logical name, used by different HTML pages.

  • Inside Application Designer, there are defined directories and files in which the text information is stored: each application project is represented by a directory under the web application directory of Application Designer. (See Application Project Management for more details on managing projects.) Inside the project directory, there is a directory /multilanguage/. Under this directory, each language is represented by its own directory, e.g. by the directory /multilanguage/de/ for German translations.

  • Inside each language directory, there is one comma separated value (CSV) file for each page name. The name of the file is <pagename>.csv (for example, Login.csv).

  • Inside the CSV file, each line contains the text ID, a semicolon and the label text, e.g. "Label1;Login name".

The following topics are covered below:


Example

Let us assume you have defined an application project "accountmgmt". Inside the application project, there is a layout definition account.xml that points via the translationreference property of PAGE to "account". The file structure inside your application project directory now looks as follows:

<webapp-directory>/
  accountmgmt/
    account.html                        // generated HTML file
    multilanguage/
      de/
        account.csv                     // German text
      en/
        account.csv                     // English text
    xml/
       account.xml                      // layout definition

Page Name Strategy

The previous section explained how a translation file is found for a certain HTML page. Basically, the translation reference is used to link the layout definition and the Application Designer multi language management.

In general, there are two strategies for using this translation reference, and a mixture of both:

  • Specify one central page name for a couple of pages. Therefore, all pages share the same multi language information (i.e. the same .csv file).

  • Specify one page name for each page. Therefore, every page has its own .csv file.

For larger projects, it makes sense to combine different literal information into one file - in order to keep consistency and to avoid redundancy. Of course, you have to synchronize the naming of text IDs for each page.