Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13182 closed defect (fixed)

dojo.i18n._preloadLocalizations called too late

Reported by: jameyg Owned by: Rawld Gill
Priority: high Milestone: 1.7
Component: BuildSystem Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

The following fails when running against a built layer w/ preloaded resource bundles:

dojo.require('dojo.i18n');
dojo.requireLocalization('foo', 'bundle');
dojo.declare('foo.Bar', null, {
   nlsBundles: [
     'bundle': dojo.i18n.getLocalization('foo', 'bundle')
   ]
});

this may be an uncommon construct, but it seems like it should be valid. The getLocalization call fails in a built layer, however, because _preloadLocalizations() isn't called until the end of the layer.

Change History (6)

comment:1 Changed 8 years ago by Rawld Gill

Status: newassigned

comment:2 Changed 8 years ago by Terence Kent

+1 for this bug.

I ran into this issue as well and it took me quite a while to determine what the problem was. Here was my situation:

Several of our modules required dojo.date.locale and would call dojo.date.locale.format() during initialization. Our non-built modules worked without an issue, but the built version of our modules our code broke with the following exception:

Failed loading ../../dojo/../xw/base.js with error: 
Error: Bundle not found: gregorian in dojo.cldr , locale=en-us

We are getting around the issue by avoiding any calls to dojo.date.locale.format during the initialization of our modules, but would really like to see it fixed.

comment:3 Changed 8 years ago by blah

I'm seeing this as well as a number of other people out there:

http://goo.gl/KUBqF

comment:4 Changed 8 years ago by extph

I have a similar issue with many widgets (derived from dijit.Dialog and dojox.grid.EnhancedGrid?). However, I've got one derived from dijit.form.Form that seems to work correctly even after using the buildSystem.

An example of a widget that is failing looks like this:

dojo.require("dojox.grid.EnhancedGrid?");

dojo.require("dojo.cache"); dojo.require("dojo.i18n");

dojo.requireLocalization("auth", "UserGrid?");

dojo.provide("auth.UserGrid?");

dojo.declare("auth.UserGrid?", dojox.grid.EnhancedGrid? , {

postCreate: function() {

this.inherited(arguments);

try {

var _nlsResources = dojo.i18n.getLocalization("auth", "UserGrid?");

} catch (err) {

alert(err);

}

}

});

This is a major issue for me since internationalization cannot be used as soon as you use the build system and Dojo is not workable without any build since it takes too much resources.

I don't see any workaround on my side. Having this fixed in a 1.6.2 release would be nice. Is there any time when this should be release?

comment:5 Changed 8 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

This is fixed in 1.7. Please pull from trunk, give it a try. If you still have problems, reopen this ticket.

comment:6 Changed 8 years ago by bill

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.