Show TOC

Creating a Resource Model InstanceLocate this document in the navigation structure

The resource model is used as a wrapper for resource bundles. You can, for example, bind texts of a control to language-dependent resource bundle properties.

Procedure

  1. With a bundleName, that is, the name of a resource bundle and equals a SAPUI5 module name within the require/declare concept
  2. With a bundleUrl that points to the resource bundle
    If you use the bundle name, the file must have the .properties suffix. If you do not specify a locale, the system uses the login language
    var oModel = new sap.ui.model.resource.ResourceModel({bundleName:"myBundle",locale:"en"});
    Note In this ResourceModel implementation you cannot pass parameters to your texts within the resource bundle. If you have to pass parameters, you must do this on your own. Therefore, you can load the bundle yourself or retrieve it from the model.
    var myBundle = oModel.getResourceBundle();

    After the instance has been created, you have a model containing the resource bundle texts as data.