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.
The resource bundle sap.ui.commons.message_bundle consists of the following individual files:
To enable proper translation, you classify the texts with additional information, at least with the text type. Place the additional information in the line directly above the text element, beginning with the number sign (#). For more information, see Text Classification.
A properties file can, for example, look like this
#!properties#XMSG HELLO_WORLD = Hello World #XBUT,10 BUTTON_SAVE = Save #XFLD,30: Greetings displayed in the upper right corner of the screen welcome = Welcome {0}
If you are using SAPUI5 in SAP HANA, resource bundles files must have the extension *.hdbtextbundle instead of *.properties.
#!js// require the jQuery.sap.resources module jQuery.sap.require("jquery.sap.resources"); // load the resource bundle var oBundle = jQuery.sap.resources({ // specify url of the .hdbtextbundle url : "i18n/messagebundle.hdbtextbundle" });