cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Localization in MII using SAPUI5

Former Member
0 Kudos
459

Hello All,

I am trying localization using SAPUI5 and for the same reason I am trying to call resource bundle from META-INF in js file using the following syntax

url: '/XMII/Catalog?ObjectName=CustomerExamples/META-INF/Bundles/<Project>_<language>.properties&Mode=LOAD'

But, I am getting below error while referring to the above syntax.

Error: resource URL '/XMII/Catalog?ObjectName=CustomerExamples/META-INF/Bundles/<Project>_<language>.properties&Mode=LOAD' has unknown type (should be one of .properties,.hdbtextbundle).

Please let me know if there is any fix to it or something that is missing in the above syntax.

Thanks.

Harsh

View Entire Topic
RiaNinan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Harsh,

As mentioned by Christian, MII Catalog services will give you the encoded content of properties files, which cannot be used by the localization service of SAP UI5. This means to use the MII message bundle properties file with SAP UI5 application you could copy the same in your web folder and then use it as shown below:

jQuery.sap.require("jquery.sap.resources");

var oBundle = jQuery.sap.resources({url : "CM/<Project>/messages.properties", locale: "en"});

oBundle.getText("XLBL_KEY"); //this will give the localized value

Hope this help!

Do let us know if you find some other way for resolving this.

Thanks and Best Regards,

Ria

salvatore_castro
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can also hide a text field on your web page (make sure it has the extension .irpt) like this:

<input id=localized name=localized type=hidden value={##LocalizationKey} />


This will put the value of the localized entry directly onto your page and you can reference it directly in JS or you can change the type field to be visible; works well for field labels.  This is documented in the MII help here: http://help.sap.com/saphelp_mii151sp00/helpdata/en/4c/8c1960f2bd60c8e10000000a15822d/frameset.htm


Sam

Former Member
0 Kudos

Hi Ria,

Thanks for your suggestion.

I had tried the method that you have suggested and localization was working when I copied the bundle resource in web folder and gave the path under URL.

I am checking on how we can get it done while referring to resource bundle from META-INF folder. Will keep you posted if I come across with some resolution to this.

Thanks,

Harsh