Skip to Content

Fragment calls wrong i18n path after deployment to fiori launchpad

Dear Experts,

we developed a custom SAPUI5-App with one main view and two fragments. We have three i18n-files for different languages.

If I test the i18n translations in my local WebIDE everything is fine. But after we deployed the app in our Fiori launchpad an error occured while loading the i18n files.

If I open the app in the launchpad the main view is loading the correct i18n files and the labels are translated. But if I open the fragments, F12 says that it cannot load the i18n files. When I was analyzing the Network requests I noticed, that the main view is calling the correct path of the i18n file but the fragments are calling another path wich is wrong and after that there is a 404 error (not found).

I tried many things:

  • Set the i18n model for every single fragment
  • Use the function "addDependent" in the create and calling methods for the fragment
  • Check the manifest.json and the component.js for wrong resources or path
  • Check the mapping file of the bsp application

Nothing works. And again: It works in my local test environment.

Inside the launchpad the main view is calling the correct path: https://XXX/sap/bc/ui5_ui5/sap/zindivsel_nmf/~A511A000B4A95D2839F3719D216182DE~5/i18n/i18n_it.properties

Inside the launchpad the fragments are calling the wrong path: https://XXX/sap/bc/ui5_ui5/ui2/ushell/shells/abap/i18n/i18n_it.properties

Did somebody know why this happens and how can I fix it?

Regards,

Tim

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    Posted on May 21, 2019 at 01:36 PM

    Dear Experts,

    thanks a lot for your ideas and help. I solved the problem now.

    In my case the solution was that I have to put the "addDependent" statement not inside my "createViewSettingsDialog" method rather then in my button event method if I`m clicking the filter / sort button.

    So finally it was only one line of code to solve the problem :)

    Here also my Code for all who have the same issue:

    // Create the Dialog
    createViewSettingsDialog: function(sDialogFragmentName) {
    var oDialog = this._mViewSettingsDialogs[sDialogFragmentName];
    if (!oDialog) {
    oDialog = sap.ui.xmlfragment(sDialogFragmentName, this);
    this._mViewSettingsDialogs[sDialogFragmentName] = oDialog;
    }
    return oDialog;
    },
    
    
    // Button-Event for Sort
    handleSortButtonPressed: function() {
    this.getView().addDependent(this.createViewSettingsDialog("zindivsel_nmf.view.SortDialog"));
    this.createViewSettingsDialog("zindivsel_nmf.view.SortDialog").open();
    },
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 17, 2019 at 03:13 AM

    Can you please show the code where you are appending the fragment. You might be able to use the answer from this. https://stackoverflow.com/questions/25636637/localizationi18n-in-sapui5-for-fragment-xml-file-in-not-appearing

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 20, 2019 at 11:58 PM

    Hi Tim, Can you try to use below path?

            var rootPath = jQuery.sap.getModulePath("<Module Path>");
            var i18nModel = new sap.ui.model.resource.ResourceModel({
                bundleUrl : [rootPath, '<i18n Path>'].join("/")
            });
            this.setModel(i18nModel, "i18n");

    Regards,

    Karthik Arjun

    Add a comment
    10|10000 characters needed characters exceeded

    • Jun Wu The i18n models are already defined in my manifest.json (see here i18n-manifest.png)

      Karthik Arjun Thanks a lot for your code snippet. I was putting it with my custom path in my coding:

      var rootPath = jQuery.sap.getModulePath("/sap/bc/ui5_ui5/sap/zindivsel_nmf");
      
      var i18nModel_it = new sap.ui.model.resource.ResourceModel({
      bundleUrl: [rootPath, 'i18n/i18n_it.properties'].join("/")
      });
      this.setModel(i18nModel_it, "i18n_it");

      After that, the following (wrong) path is used in the launchpad (only the second part that is given trough the coding would be right):

      https://XXX/sap/bc/ui5_ui5/ui2/ushell/resources/~20190213161400~/sap/bc/ui5_ui5/sap/zindivsel_nmf/i18n/i18n_it.properties

      new-path.png

      Is it possible to overwrite the first part "sap/bc/ui5_ui5/ui2/ushell/resources/~20190213161400~/" with my second part?

      Thanks for your help!

      Regards,

      Tim

      i18n-manifest.png (11.5 kB)
      new-path.png (9.8 kB)
  • Posted on May 21, 2019 at 11:08 AM
    <Module Path> is the id in your manifest.json. not that url
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.