Why does the Mendix modeler dependency check failing, while this code runs fine?
define([
"dojo/_base/declare",
"dojo/i18n!widgets/MyWidget/widget/nls/messages.js"
], function (declare, localMessages) {
return declare("MyWidget.widget.SayLocalHello", [], {
constructor: function () {
console.log(localMessages.hellowWorld);
}
});
});
require(["MyWidget/widget/SayLocalHello"]);
This bit of code will say hello world in using the i18n messages as used as described in dojo ref guide:
https://dojotoolkit.org/reference-guide/1.10/dojo/i18n.html
In the real word widget, it uses 250+ messages in a view languages, ideally to use dojo's i18n
The messages.js files does exist on the given location, however the widget build message says:
error(311) Missing dependency. module: MyWidget/widget/SayLocalHello; dependency: dojo/i18n!widgets/MyWidget/widget/nls/messages.js; error: Error: i18n resource (widgets/MyWidget/widget/nls/messages.js) missing
Update Solution:
define([
"dojo/_base/declare",
"dojo/i18n!MyWidget/widget/nls/messages"
], function (declare, localMessages) {
return declare("MyWidget.widget.SayLocalHello", [], {
constructor: function () {
console.log(localMessages.hellowWorld);
}
});
});
require(["MyWidget/widget/SayLocalHello"]);