Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1936 closed defect (fixed)

Custom builds should flatten all i18n bundles

Reported by: James Burke Owned by: James Burke
Priority: high Milestone:
Component: BuildSystem Version: 0.4
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by James Burke)

i18n bundles that are not part of the built dojo.js file make many requests for parent locales. Some of these requests results in 404s.

Example being using an ajax build but using DropdownDataPicker? causes 404s as it tries to load the bundle for DropdownDataPicker?.

Use an approach that is used by xdomain loading to flatten those resources and inform the resource loader what locales are available to load.

Attachments (1)

1936.patch (32.5 KB) - added by James Burke 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by James Burke

Description: modified (diff)
Milestone: 0.4.1

Going to try to get this in the build process in the next two weeks for 0.4.1. But need to get the process checked out with other contributors and try on trunk first before getting clearance to push it to the 0.4.1 branch. If it doesn't hold together, push to 0.5.

Changed 13 years ago by James Burke

Attachment: 1936.patch added

comment:2 Changed 13 years ago by James Burke

I just attached a patch for this issue. The purpose of this patch is to use the solution I use for xd loading for normal builds.

However, as part of this change, more of the files in src/ are modified. These modifications only happen in the release directory, but it is something a little bit new for dojo builds. I think it is fitting for this to happen since the purpose of the build system is to do optimizations, and some of those optimizations may mean source code modification.

However, because source code is modified, this type of bundle flattening is not done for 3rd party modules right now. We need to have a better story for including 3rd party modules in the build system before we allow it. At first pass, I think it means copying the 3rd party module files into the dojo release folder and doing the work there. Perhaps something to work out for 0.5.

Basic approach:

  • Each release_dir//nls/*.js file gets flattened. Note that this is different from the flattening that happens when you have modules in your custom dojo.js that use i18n bundles. That dojo.js type of flattening is still done, but for bundles that are not part of the dojo.js loading, they get individually flattened. (Flattening in this case means instead of asking for nls/bundle.js, nls/en/bundle.js and nls/en-us/bundle.js, the bundle properties from all three files are flattened and included in nls/en-us/bundle.js.
  • All .js files in release_dir/src are scanned for dojo.requireLocalization() calls. If one is found, then the .js file is modified and a 4th parameter is added to dojo.requireLocalization(), the list of available, flattened locales for that bundle. This allows the i18n loading system to make just one request per bundle, and bundles are not loaded until the module making the dojo.requireLocalization() call is loaded.

Some notes:

  • I'm a little concerned about the file saving I added to builscripts/flattenResources.js (look toward the bottom for buildUtil.saveUtf8File()). I'm not sure if it is safe to assume UTF-8 in this case.
  • This patch moves a few methods from buildUtilXd.js to buildUtil.js, to move the solution I had for xd loading into the normal build path. So, you will see lots of red for buildUtilXd.js and lots of green in buildUtil.js when looking at the trac view of the patch.
  • I'm still testing all the build configurations, but so far it looks good. I'll need to test a little bit more though, and do some testing on Windows (been using OSX).

comment:3 Changed 13 years ago by James Burke

(In [6717]) References #1936. Fixes the issue for trunk. Adam has done an initial review and gave OK for trunk. We will finish the review tomorrow and if all goes well, move the change to the 0.4.1 branch at that point.

comment:4 Changed 13 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [6725]) Fixes #1936. Flatten all i18n bundles in the build process (merge from trunk r6717).

comment:5 Changed 12 years ago by (none)

Milestone: 0.4.1

Milestone 0.4.1 deleted

Note: See TracTickets for help on using tickets.