Skip to content

Latest commit

 

History

History
61 lines (33 loc) · 3.06 KB

Step_7_Optional_Resource_Bundles_and_Multiple_Languages_4e593b4.md

File metadata and controls

61 lines (33 loc) · 3.06 KB
loio
4e593b44e78a431e8b21be6b3915fb55

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.

Parent topic:Data Binding Tutorial

Next:Step 6: Resource Models

Previous:Step 8: Binding Paths: Accessing Properties in Hierarchically Structured Models

Related Information

Localization