on 2016 May 04 7:26 AM
Hi All,
On setting json model for example data1.json to view, I want i18n>submit to be displayed on the button. The same button should display i18n>cancel on setting data2.json. How can I achieve this? Please let me know the source wherein I can know all about this.
Sorry for my ignorance.
Thanks in advance.
Request clarification before answering.
Hi Kumar,
load your i18n model and bind it to your view or core as follow:
than I wrote i function where i can get the i18n texts like:
geti18n: function(sMsg) { | |||
return sap.ui.getCore().getModel("i18n").getResourceBundle().getText(sMsg); | |||
}, |
sMsg is the i18n code.
just give your button an ID. Than you can set the text like this.getView().byId("myButton").setText(geti18n('submit'));
haven't tried it but should work.
Regards,
Samuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for your reply.
I got the answer. I used the formatter function in button text to achieve.
Here is how I got it.
new sap.ui.commons.Button("Button1",{
text: { path: 'screen>/finalButt1',
formatter: function(s) {
return sap.ui.getCore().getModel("i18n").getResourceBundle().getText(s);
}
},
press : function(){
oController.onSubmit();
}
});
User | Count |
---|---|
79 | |
21 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.