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
javascript internationalization dojo dojo-build


source to share


No one has answered this question yet

Check out similar questions:

5129
How do I return a response from an asynchronous call?
1198
Pure JavaScript jQuery $ .ready () equivalent - how to call a function when the page / DOM is ready for it
fourteen
Dojo 1.8 and builds (or lack thereof)
6
Dojo Build ...? Now what?
4
wiresjs and dojo using the dojo build system (2)
2
dojo: using registry.byID returns "undefined"
1
Dojo 1.8 Build Layer Modules not available during analysis
1
How to invalidate Dojo / Require module cache?
1
Error: defineAlreadyDefined after applying dojo build
0
Using requireLocalization and getLocalization in Dojo



All Articles
Loading...
X
Show
Funny
Dev
Pics