Skip to content

Latest commit

 

History

History
47 lines (22 loc) · 1.89 KB

step-7-optional-resource-bundles-and-multiple-languages-4e593b4.md

File metadata and controls

47 lines (22 loc) · 1.89 KB

Step 7: (Optional) Resource Bundles and Multiple Languages

Resource bundles exist to enable an app to run in multiple languages without the need to change any code. To demonstrate this feature, let's create a German version of the app – in fact, all we need to do is create a German version of the resource bundle file. In our code, we activate the German locale for the ResourceModel.

Preview

The texts are now adapted for the German locale

The graphic has an explanatory text

Coding

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

In the i18n folder, duplicate the i18n.properties file and rename its copy to i18n_de.properties. Replace the English text with the German text provided below. The suffix de represents the locale for the German language. Since the de locale is already set in the supportedLocales configuration of the manifest.json, it will be taken into account.

# Field labels
firstName=Vorname
lastName=Nachname
enabled=Aktiviert

# Screen titles
panelHeaderText=Data Binding Grundlagen

To check the result, append the sap-language=DE URL parameter to the URL in your browser, for example http://localhost:port/index.html?sap-language=DE. Once you remove this parameter, your app reverts to your browser's default language.

Related Information

Localization