Show TOC

Resource BundlesLocate this document in the navigation structure

A resource bundle file is a Java properties file (as described in the Javadoc of class java.util.Properties). It contains key/value pairs where the values are the language-dependent texts and the keys are language independent and used by the application to identify and access the corresponding values.

Resource bundles are a collection of *.properties files. All files are named with the same base name (prefix identifying the resource bundle), an optional suffix that identifies the language contained in each file, and the fixed .properties extension. The language suffixes are formed according to the older JDK locale syntax. By convention, a file without a language suffix should exist and contain the raw untranslated texts in the developer's language. This file is used if no more suitable language can be found.

When a localized text is needed, the application uses the SAPUI5 APIs to load the properties file that matches the current language best. The same applies to any other localized data that can be represented as a string, for example, a date formatter string. To retrieve a text from the properties file, the application uses the (language-independent) key. If no text can be found for this key, the next best matching file is loaded and checked for the text. Finally, if no file matches, the raw file is loaded and checked.

Example

The resource bundle sap.ui.commons.message_bundle consists of the following individual files:

  • sap.ui.commons.message_bundle.properties: Contains the raw texts form the developer, determines the set of keys
  • sap.ui.commons.message_bundle_en.properties: Contains English texts (without a specific country)
  • sap.ui.commons.message_bundle_en_US.properties: Contains texts in American English
  • sap.ui.commons.message_bundle_en_UK.properties: Contains texts in British English