cancel
Showing results for 
Search instead for 
Did you mean: 

i18n not working for extended app after deployment

Former Member
0 Kudos

Hello experts,

I have extended Shopping Cart Fiori app. I would like to use a custom text in my extended app. Following the standard method, I have added this text in my i18n.properties and i18n_en.properties files of my extended app under i18n folder. I am able to access this and the custom text is displayed as well when I run the app in eclipse environment.

But the problem occurs after deploying the app to ECC. Somehow, I am unable to get the right values. I see in the network tab there are 2 property files which returns 404 error :

Could this be an issue?

It's strange how the text is visible when I run it in my eclipse environment and doesn't work after deployment.

Below is how Component.js file looks like in my extended app:

Please let me know where i'm I wrong. Help much appreciated.

Regards,

Prerana

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

try,

config : {

            bundleName : "i18n/i18n.properties",

        }

      

init : function() {

        sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

        var mConfig = this.getMetadata().getConfig();

        // Always use absolute paths relative to our own component

        // (relative paths will fail if running in the Fiori Launchpad)

        var oRootPath = jQuery.sap.getModulePath("NAMESPACE");

        // Set i18n model

        var i18nModel = new sap.ui.model.resource.ResourceModel({

            bundleUrl : [oRootPath, mConfig.resourceBundle].join("/")

        });

        this.setModel(i18nModel, "i18n");

Former Member
0 Kudos

Thanks a lot, Santosh!

It worked. The following is what I have in my Component.js  :

init : function() {

  if (ui.s2p.srm.sc.approve.Component.prototype.init !== undefined)

  ui.s2p.srm.sc.approve.Component.prototype.init.apply(this, arguments);

 

  sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

        var mConfig = this.getMetadata().getConfig();

        // Always use absolute paths relative to our own component

        // (relative paths will fail if running in the Fiori Launchpad)

        var oRootPath = jQuery.sap.getModulePath("ui.s2p.srm.sc.approve.SRM_SC_APVExtension");

        // Set i18n model

        var i18nModel = new sap.ui.model.resource.ResourceModel({

            bundleUrl : [oRootPath, mConfig.resourceBundle].join("/")

        });

        this.setModel(i18nModel, "i18nCustom");

  },

But I left the config area as the following since I want to replace the standard text with a custom:

config : {

  "sap.ca.i18Nconfigs" : {

  bundleName : "ui.s2p.srm.sc.approve.SRM_SC_APVExtension.i18n.i18n",

               }

            },

Thanks again for the answer!

Best,

Prerana

santhu_gowdaz
Active Contributor
0 Kudos

Not a problem in your config area,

because you will get "bundleName" properly through config. so fine it is solved your issue.

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

pass

jQuery.sap.getModulePath("ui.s2p.srm.sc.approve.SRM_SC_APVExtension") + "./i18n/i18n.properties"

to bundleUrl

Former Member
0 Kudos

Yes, the app failed to recognise the path. Now, its referring to my extended app and not the standard app.

Thanks.