Tips & Tricks - Multilingual Data Records

If you want to display data records in multiple languages in a portal—for example, German and English—you’ll need both the translation of the data record for each language and the two-letter language codes according to ISO 639-1, in this case, for example, “de” for German and “en” for English. You can, of course, apply the procedure described below to an unlimited number of languages.

Create an application

Create a new application using the "Basic Application" application template.

From the main menu, select "New / Data Field"(which appears when the data group is selected in the application structure ) to create a new data field titled "Language Code" with the data type "Short Text." 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 click "Zoom" to switch to the zoom view.

Create a selection list here and name it "Language." Click "Next."

Select the "Special Value Sources" option and the "LanguageListProcessor" class here. Click "Next."

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

Go to the "All Entries" page, open the Properties dialog box for 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 one German and one English data record here on the input page. The table on the "All Entries" page displays both records along with their language codes.

The "LanguageListProcessor" class is therefore responsible for displaying the language names in the drop-down list. This makes selecting a language much more convenient than selecting language codes, which can easily be confused. The "LanguageListProcessor" class stores the corresponding language code in the data field. Only by saving the language code can you ensure that the data records are displayed in the appropriate language later on.

Using the "control.listbox.language.usePortalSettings" setting, you can also choose to list only the languages that are enabled in the portal. You can find more information here.

To filter the records by language, please open the view table's Properties dialog box again.

Set up the filter here by comparing the "Language Code" data field with the "Language" system value. Publish the application.

Reload the application in your browser (press F5). If your portal is set to German, only the German data record will now be displayed in the table. Switch the portal to "English."

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

The "Dynamic View" element can be configured to display language codes that have already been saved, just like the drop-down list, and will then show the full name of the language instead of the codes.