Hi Everyone,
I went through this blog
Localization in SAP-MII Using UI5
Also suggested an improvement. Which went through several discussion so Mike asked me to start the discussion.
Harsh asked me a question:
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 syntax you had provided above. 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.
I provided information:
Save this as irpt file
<SERVLET NAME="Catalog">
<HR>
Illuminator Content Here
<HR>
<PARAM NAME= "Mode" VALUE="LOAD">
<PARAM NAME= "ObjectName" VALUE="Default/META-INF/Bundles/Default.properties">
<PARAM NAME= "Stylesheet" VALUE="/XMII/CM/Default/XSL/metaInf.xsl">
</SERVLET>
Copy these GitHub Files:
ilyakharlamov/xslt_base64 · GitHub
You have to change the path of the files as per your server.
Now write the xsl as below at Path /XMII/CM/Default/XSL/metaInf.xsl:
------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java"
xmlns:b64="<the path where you saved the GitHub files>">
<xsl:output method="text" media-type="text/csv" encoding="UTF-8"/>
<xsl:include href="base64.xsl"/>
<xsl:template match="/">
<xsl:for-each select="Rowsets">
<xsl:for-each select="Rowset">
<xsl:for-each select="Row[Name='Payload']/Value">
<xsl:variable name="value" select="."></xsl:variable>
<xsl:call-template name="b64:decode">
<xsl:with-param name="base64String" select="$value"></xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
--------------
You may need to correct the GitHub file for new line.
Now use the irpt file in the URL parameter.
Chirstian provided information:
Thanks for coming back and posting a more complete solution. I had hoped there was a way to do this without the base 64 conversion that I had not discovered.
The Catalog service is undocumented by SAP and there have been some changes over the years. I recommend caution in using it this way in a production environment.
I think a better solution would be to ask SAP to make improvements to the MII localization infrastructure to accommodate UI5.
____________________
I already sent a mail to SAP as a suggestion to make localization standard for using in UI5. But currently I am using the approach provided above. I also created a XSL file which does the base 64 conversion but that became a proprietary object for the client and I can not share that file here(My Managers asked me to write this here). So I gave the GitHub link which has GPL license.
--------------------------------
Thanks and regards,
Pradip