javascript - i18n model doesn't work properly -
i have code checks response server , shows message box according information received. have these messages in 2 languages (user selects language during login). here example:
if(sresponse == 'idfail'){ sap.m.messagebox.alert ("{i18nresourcemodel>idnotnine}", {icon: sap.m.messagebox.icon.error, title: "{i18nresourcemodel>error}"} ); }
here i18n model declaration (it declared before use model, of course):
var oresourcemodel = new sap.ui.model.resource.resourcemodel ({bundleurl: "i18n/i18n.properties", bundlelocale: "en"}); sap.ui.getcore().setmodel(oresourcemodel, "i18nresourcemodel");
i have 2 .properties
files: i18n.properties
(english) , i18n_iw.properties
(hebrew).
the strange thing title
of message box translated correctly, instead of message see text: "i18nresourcemodel>idnotnine".
it worked fine before , can't figure out happened.
what may causing issue , how fix it?
thank you.
databinding not working in function call sap.m.messagebox.alert()
. have text manually like:
var resourcemodel = sap.ui.getcore().getmodel("i18nresourcemodel"); var alerttext = resourcemodel.getproperty("idnotnine"); var alerttitle = resourcemodel.getproperty("error"); sap.m.messagebox.alert(alerttext, { icon: sap.m.messagebox.icon.error, title: alerttitle } );
additionally can have @ latest guide on how use resourcebundle here.
Comments
Post a Comment