cancel
Showing results for 
Search instead for 
Did you mean: 

i18n model defined in manifest.json is not created

Former Member
0 Kudos

Hi Guys,

I am now following the latest walkthrough tutorial in http://veui5infra.dhcp.wdf.sap.corp:8080/demokit/#docs/guide/8f93bf2b2b13402e9f035128ce8b495f.html

after I define the i18n model metadata in manifest.json .  see  "manifest.json" in the above url

while I set breakpoint in Component.js 's init() method,  and by accessing this.getMetadata()._oStaticInfo.manifest, I see all

the metadata parsed.      see attached file "Capture1.png"

However, when I try to acces i18n model by this.getModel("i18n"),  I get nothing.  see attached "Capture2.png"

neither can I access the i18n model in view's controller by this.getView().getModel("i18n").

However, ui5 do parse the "rootView" property under  "sap.ui5" in manifest.json file. otherwise the rootView will not be loaded and initiated.

see attached "Capture3.png"



seems that manifest json is loaded and parsed, but only partly used.  the i18n is not initiated.


I am doubting that I have configured it wrong, but I fully downloaded from tutorial. and since this manifest.json is newly introduced and with limited material for reference, I have no idea where to go except dive into ui5-core souce code, which takes much time.

I am wondering if anyone met this before .

Thanks,

Accepted Solutions (0)

Answers (3)

Answers (3)

vardan_goyal
Explorer
0 Kudos

Hi Torren,

I am also beginner for this SAPUI5 and my manifest.json file is not working. If I use simple rootView in metadata of component.js file then it is working fine but not working with manifest.json file.

my sap.ui.version is 1.30.3.

Please help if your problem got resolved.

Thanks & Regards,

Vardan

mauriciolauffer
Contributor
0 Kudos

Hi.

It's working for me.

In your Component.js use:

this.getModel("i18n");

In your view's controller.js use:
this.getView().getModel("i18n");

Former Member
0 Kudos

Hi Torren,

First thing to access the i18n model is that you need to create a "Resource Model" instance and then set the view.

Below is the piece of code i have user for i18n in my component.js file.

Step1:  Define resourceBundel <path of you i18n files>

config : {

    resourceBundle : "i18n/messageBundle.properties"

    serviceConfig : {

            name : <Your Service Name>,

            serviceUrl : <Your Service URL>

            }

Step2:  Define rootPath resource Model.

// always use absolute paths relative to our own component

// (relative paths will fail if running in the Fiori Launchpad)

var rootPath = jQuery.sap.getModulePath(<Root folder name>);

// set i18n model

var i18nModel = new sap.ui.model.resource.ResourceModel({

bundleUrl : [rootPath, mConfig.resourceBundle].join("/")

});

this.setModel(i18nModel, "i18n");

Hope this will help you.

Regards,

Abhijeet

Former Member
0 Kudos

Hi Parihar,

the way you recommend is the traditional way, but the latest ui5 of version 1.30 provide a new way of creating the model. Actually you don't need to create the model your self, you just need to give the model metadata in manifest.json file, and ui5 will take care of the rest for you.

I just find that my ui5 version is less than 1.30, so this function is not provided yet.

Former Member
0 Kudos

Hello Torren,

Have you solved this problem? I have also encountered this issue. Could you give me some advice?

Thanks.

TimMuchena
Participant
0 Kudos

Hi

Have you managed to solve this problem? I have reverted back to defining the resource model in the Component.js in the interim but would love to use the manifest.json way

Thanks and kind regards

Former Member
0 Kudos

Hello Eli,

That's because version 1.28 doesn't support this definition.

I think you can use web-ide if you want to use manifest defined i18n model.

The latest UI5 version in Eclipse plugin is 1.28. In web-ide you can use version 1.30 or above.

Thanks and best regards.