Tips & Tricks - Multilingual data records

If you would like to show data records in more than one language in the portal, e.g. German and English, you need the translation of the data record in each language and the two-letter language code according to ISO 639-1 - 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 based on the application template “Basic application”.

Select the data group in the application structure and create a new data field via the New menu / Data field. Enter "Language code" as the title and select "Short text" as the data type. Click on "OK".

Select the "Entry" input page in the application structure. On the workspace, select the container containing 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 on "Next".

Select the "Special value sources" option and the "LanguageListProzessor" class here. Click on "Next".

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

Now switch to the "All entries" page and open the properties dialog of the view table and add the data field "Language code" as a table column. Click on "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 records" page now shows both records with the language code. The function of the class “LanguageListProcessor” is therefore to display the language names in the drop-down list. It is much easier to select a language than to select the right language code, as these are easily confused. The class “LanguageListProcessor” 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. To filter the data records dependent on the language, please reopen the properties dialog of the view table.

Create a filter that compares the data field "Language code" with the system value "Language". Publish the application.

Refresh the application in the browser (F5 key). If your portal is set to English, only the English data record will be shown in the table. Now switch the portal to “German”.

The table now shows the German data record only. Besides the class "LanguageListProzessor", which provides the entries of the selection list for the language, there are many other classes, such as those that list only the languages you have set in the country settings of the portal properties. Click here for more information. The “dynamic view” element can also be set up to display already saved language codes, like the drop-down list, and then provides the language names instead of the codes.