I18n getLocalization returns undefined on first call when using Dojo Build

I recently noticed strange behavior with the inline version of my dojo apps. Some buttons are labeled undefined. This behavior only exists in the version built with dojo Build.

After careful testing, it happens that the first call returns "undefined", and subsequent calls return the correct message object.

However, to make things even more interesting, subsequent calls within the same "require" will still return undefined. So, following the snipplet in the Firebug Console:

require(["dojo/i18n"],function(i18n){
 for (var i in [1,2])
 console.log(i18n.getLocalization("app.ui.widgets", "dialogs", "de"))
})

      

prints 'undefined' on the first call, and on the second it returns values.

My nls/dialogs.js

:

define({ root:
//begin v1.x content
({
  tooMuchElements: "Too many elements. Only the first ${N} are shown.",
}),
//end v1.x content
"de": true,
});

      

My nls/de/dialogs.js

:

define(
({
  tooMuchElements: "Zu viele Elemente. Nur erste ${N} sind gezeigt.",
})
);

      

Everything works correctly without building. What's the problem here? Is this some kind of build bug, or is this some kind of expected behavior and I need to do some "extra" initialization when using the build?

I am using dojo 1.9.2.

+3


source to share





All Articles