Skip to Content

i18n SAPUI5 global translation in eclipse

Hi expoerts,

I am facing with problem with translation using i18n. I was reading all tutorials, and nothing is working.

i created model in my controller

and using

----view-----

var oPage = new sap.m.Page({
       title : "{i18n>shellTitle}",
sap.ui.controller("dyn2.test", {

content : [oTab]
     });


----- controler -------

onInit: function() {
     var oResourceModel = new sap.ui.model.resource.ResourceModel({
       bundleName : "dyn2.i18n"
     });

     // Assign the model object to the SAPUI5 core using the name "i18n"
     sap.ui.getCore().setModel(oResourceModel, "i18n");

any idea what is wrong?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 24, 2017 at 09:43 PM

    why are you not using manifest.json to set i18n model?

    Add comment
    10|10000 characters needed characters exceeded

    • manifest.json under sap.ui5 --> models section write below code

      "sap.ui5":{
          "models": {
                "i18n": {
                     "type": "sap.ui.model.resource.ResourceModel",
                      "settings": {
                          "bundleName": "dyn2.i18n"    //path of i18n file
                      }
                 }
          }
      }
  • Jul 25, 2017 at 06:36 AM

    Have you placed the i18n.properties file directly within the webapp folder or inside the i18n folder within webapp? If it is the latter then you will have to change the bundleName property in your resource model as

    bundleName: "dyn2.i18n.i18n"

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 04, 2017 at 11:41 AM

    I have the correct resolution of my issue. I made it in controller. Instead of parameter bundleName i used bundleUrl

    var i18nModel = new sap.ui.model.resource.ResourceModel({bundleUrl:"./i18n/i18n.properties"});
    sap.ui.getCore().setModel(i18nModel, "i18n");

    Maybe it will help somebody.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 02, 2017 at 06:44 PM

    If you have found the answer, close the thread as answered so others can look up this thread in future.

    Add comment
    10|10000 characters needed characters exceeded