Show TOC

Step 7: (Optional) Resource Bundles and Multiple LanguagesLocate this document in the navigation structure

The reason we have resource bundles is to allow an app to run in multiple languages without the need to change any code. To demonstrate this feature, we will create a German version of the app – in fact all we need to do is create a German version of the resource bundle file. No code changes are needed.

Preview
Figure 1: German version of our UI
Coding

You can view and download all files in the Explored app in the Demo Kit under Data Binding - Step 7.

webapp/i18n/i18n_de.properties (New)
# Field labels
firstName=Vorname
lastName=Nachname
enabled=Aktiviert

# Screen titles
panelHeaderText=Data Binding Grundlagen

In the i18n folder, take a copy of the file i18n.properties and call it i18n_de.properties. Change the English text to the German text.

To test the outcome, change the default language of your browser to German and refresh your preview.