Tips & Tricks - Multilingual data records

If you want to display data records in several languages in a portal, e.g. German and English, you need the translation of the data record for each language on the one hand, and the two-character language abbreviations in accordance with ISO 639-1 on the other, e.g. "de" for German and "en" for English. The method described below can of course be used for any number of languages.

Create application

Create a new application with the "Basic application" application template.

Create a new data field with the title "Language code" and the data type "Short text" via the main menu "New / Data field", which you can access when the data group is selected in the application structure. Click "OK".

Select the "Entry" input page in the application structure. On the workspace, select the container that contains the title field in the grid and then switch to the zoom view by clicking on "Zoom".

Create a selection list here and give it the title "Language". Click "Next".

Select the "Special value sources" option and the "LanguageListProcessor" class. Click "Next".

Select the "Language code" data field here and click "Next" and then "Finish".

Switch to the "All entries" page, open the properties dialog of the view table and add the "Language code" data field as a table column. Click "OK" and publish the application. Then switch to the browser.

Create a German and English data record on the edit page. The view table on the "All entries" page shows both data records with the language code.

The "LanguageListProcessor" class therefore has the function of displaying the language names in the selection list. It is much easier to select a language than to select the right language code, as these are easily confused. The "LanguageListProcessor" class stores the corresponding language code in the data field. The language-dependent display of data records can only be achieved with the saved language code.

With the help of the "control.listbox.language.usePortalSettings" setting, only the languages that are activated in the portal can be listed. Further information can be found here.

To filter the data records dependent on the language, please reopen the properties dialog of the view table.

Create the filter here by comparing the "Language code" data field with the "Language" system value. Publish the application.

Refresh the application in the browser (F5 key). If your portal has the German language setting, only the German data record will now be displayed in the table. Switch the portal to "English".

The table now only shows the German data record. In addition to the "LanguageListProcessor" class, which provides the entries for the language selection list, there are many other classes which, for example, only list the languages that you have set in the country settings of the portal properties. You can find more information here.

The "Dynamic view" element can be set to display previously saved language codes in the same way as the selection list and then provides the written language instead of the codes.