I want to get rid of i18n files in SAPUI5
applications. I developed an OData service that provides all the translations and removed i18n
model from manifest.json
. Also I create i18n
model based on my OData service in Component.js
.But I don't know why the elements does not bind to data of my i18n model.
Here is my code for creating Odata model:
oDataModel.read("/TranslationConfigSet", {
async: false,
filters: aFilter,
success: function(oData, response) {
var aI18n = {};
var results = oData.results;
for (var i = 0; i < results.length; i++) {
aI18n[results[i]["ZStringKey"]] = results[i]["ZTranslation"];
}
var oI18nModel = new JSONModel(aI18n);
_this.setModel(oI18nModel, "i18n");
},
error: function(oError) {
}
});
This code is placed inside of my Component.js file and inside of the xml view files I have some codes like this:
text="{i18n>TESTSTRING}"
While TESTSTRING exists in my data and my array.
var _this=this;
outside of the callback function. – user7383443