cancel
Showing results for 
Search instead for 
Did you mean: 

OpenUI5 missing 'messagebundle_en_US.properties' file

Former Member

I am using WAMP server for OpenUI5 development. I have tested my code in IE10, Google Chrome and Firefox. Google Chrome is giving me following error:

GET http://localhost/openui5-sdk-1.16.8-SNAPSHOT/resources/sap/ui/commons/messagebundle_en_US.properties 404 (Not Found)

Inside "resources\sap\ui\commons" when I add a new file of messagebundle_en.properties and rename it to messagebundle_en_US.properties, the error disappears. Is it a bug in OpenUI5 causing Google Chrome to behave like this?

demo.html


<!DOCTYPE HTML>

<html>

  <head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <script src="resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.ui.commons"

  data-sap-ui-theme="sap_goldreflection">

  </script>

  <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

  <script>

  sap.ui.localResources("ui5demo");

  var view = sap.ui.view({id:"idDemoView1", viewName:"ui5demo.DemoView", type:sap.ui.core.mvc.ViewType.JS});

  view.placeAt("content");

  </script>

  </head>

  <body class="sapUiBody" role="application">

  <div id="content"></div>

  </body>

</html>

DemoView.view.js


sap.ui.jsview("ui5demo.DemoView", {

  /** Specifies the Controller belonging to this View.

  * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.

  * @memberOf ui5demo.DemoView

  */

  getControllerName : function() {

  return "ui5demo.DemoView";

  },

  /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed.

  * Since the Controller is given to this method, its event handlers can be attached right away.

  * @memberOf ui5demo.DemoView

  */

  createContent : function(oController) {

  //Create a panel instance

  var oPanel = new sap.ui.commons.Panel({width: "400px"});

  //Set the title of the panel

  oPanel.setText("Contact Data");

  //Create a matrix layout with 2 columns

  var oMatrix = new sap.ui.commons.layout.MatrixLayout({

  layoutFixed: true,

  width: '100%',

  columns: 2

  });

  oMatrix.setWidths('100px', '200px');

  //Create a simple form within the layout

  var oLabel = new sap.ui.commons.Label({text: 'Name'});

  var oInput = new sap.ui.commons.TextField({value: 'M.Saad', width: '100%'});

  oLabel.setLabelFor(oInput);

  oMatrix.createRow(oLabel, oInput);

  oLabel = new sap.ui.commons.Label({text: 'First Name'});

  oInput = new sap.ui.commons.TextField({value: 'Siddiqui', width: '100%'});

  oLabel.setLabelFor(oInput);

  oMatrix.createRow(oLabel, oInput);

  // create ProgressIndicator

  var oProgressIndicator1 = new sap.ui.commons.ProgressIndicator("ProgInd1", {

  width: "100%",

  percentValue: 33,

  displayValue: "33%"

  });

  //Add the form and ProgressIndicator to the panels content area

  oPanel.addContent(oMatrix);

  oPanel.addContent(oProgressIndicator1);

  //Add some buttons to the panel header

  oPanel.addButton(new sap.ui.commons.Button({text: 'Save'}));

  oPanel.addButton(new sap.ui.commons.Button({text: 'Cancel'}));

  //Attach the panel to the page

  oPanel.placeAt("content");

  }

});

Accepted Solutions (1)

Accepted Solutions (1)

AndreasKunz
Advisor
Advisor

Hi,

it's not a bug nor any unintended behavior:

UI5 automatically detects the user's language/locale (from a variety of sources) and tries to load the most suitable translation resource files. For many users the locale is "en_US", but UI5 does not come with US-specific English translation, but only with standard English ("en" without "US"). Once the specific file is not found, the standard english is automatically requested. You probably see the next file requested is exactly this.

If it is also not found, the "default language" (original language written by developers, no locale suffix) is loaded.

So it's the perfectly intended automatic attempt to find the best available language.

Of course the "404-not-found" requests are not the best possible thing, so you can also configure which languages are available:, using the "data-sap-ui-xx-supportedLanguages='...'" attribute in the bootstrap script tag (not sure since which version, might be new in 1.18 or even 1.20), giving a list of locales for which the translation files are present. Then UI5 does not have to try.

The alternative solution is to create files with the most-used locales in your target environment.

Your workaround to set language="en" disables the automatic language selection, so it might not be best for all environments...

Regards

Andreas

Former Member
0 Kudos

Correction from my original post, I found a fix.

I am working with a local version of the SDK-1.24.6.

The demo site does not show the 404. https://sapui5.netweaver.ondemand.com/sdk/test-resources/sap/m/demokit/tdg/index.html?responderOn=tr...

I am running a copy of the SDK-1.24.6 locally.  When I add data-sap-ui-language="en" it does not fix the issue on this version.  Since it "UI5 automatically detects the user's language/locale (from a variety of sources)" I even tried to specify it in the document <html lang="en">.  That did not help with the detection either.

I noticed the https://sapui5.netweaver.ondemand.com demo site has a file that is not packaged with the SDK https://sapui5.netweaver.ondemand.com/sdk/test-resources/sap/m/demokit/tdg/i18n/messageBundle_en_US....

When I add that file where my local 404 is... and rename it to what the current SDK is looking for (messageBundle_en.properties instead of messageBundle_en_US.properties). It is resolved.

Just thought I would let people in on my solution.

Message was edited by: Joel Crawford-Smith

Answers (2)

Answers (2)

Former Member

Adding data-sap-ui-language="en" solved the problem for Google Chrome.

Reference:

Former Member
0 Kudos

Thank you! This solves the problem for me

oliver_sviszt
Explorer
0 Kudos

Hello andreas.kunz

While I have no problem with limiting the set of available languages or creating dummy-locales for all used languages, it seems that even the english locale is missing for some stock components.

These error messages are very annoying when developing / debugging. Is there any way of getting rid of them without faking existence of those files in a proxy?

Thanks,

Oliver