Skip to Content
0

i18n SAPUI5 global translation in eclipse

Jul 24, 2017 at 05:46 PM

175

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Srikanth KV Jul 24, 2017 at 09:43 PM
2

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you for you answer. Can you give me a working example?

0

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
                }
           }
    }
}
0
saurabh vakil Jul 25, 2017 at 06:36 AM
1

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"

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi, thanks for your reply. I placed it inside i18n folder like this:

I tried to change bundleName into "dyn2.i18n.i18n" but it doesn't help.

list.png (12.9 kB)
0
avatar image
Former Member Aug 04, 2017 at 11:41 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Sharath M G Sep 02, 2017 at 06:44 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded