Skip to Content

Localization in MII using SAPUI5

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 03, 2015 at 11:33 AM

    Hi Harsh,

    Thank you for creating the Discussion.  Adding the SAPUI5 Developer Center link so the SAPUI5 experts will also see this, though I don't think moving it there makes sense at this time.  Your question is more focused on MII content than the SAPUI5 coding.

    Regards, Mike (Moderator)

    SAP Technology RIG

    I would also suggest that you check the syntax of LOAD in hbtextbundle which is where the error message says the trouble is caused.  May not be all caps?

    Message was edited by: Michael Appleby

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 11:53 AM

    Harsh,


    I don't think you can use the Catalog service directly to get the resource files. I think it returns an xml file with the properties file binary encoded within. Check in your browsers developer tools network or resources tab to see what MII is actually sending you.

    Regards,
    Christian

    Add comment
    10|10000 characters needed characters exceeded

    • Harsh,
      I spent a lot of time dealing with the Catalog services writing an application to integrate with the MII virtual file system via FTP. I could be wrong but in my experience the Catalog service will not return the file in a way that the ui5 localization infrastructure wants. It returns a file containing the properties file as an encoded string. If there is a way to use the Catalog service to get the localization files then Pradip or someone else will have to provide a more complete example.

      Regards,
      Christian

  • avatar image
    Former Member
    Nov 03, 2015 at 05:37 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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