Ticket #5225 (closed defect: fixed)

Opened 12 months ago

Last modified 12 months ago

Certain profile layer names break packages with malformed dojo.i18n._preloadLocalizations call

Reported by: guest Owned by: jburke
Priority: normal Milestone: 1.0.2
Component: BuildSystem Version: 1.0
Severity: normal Keywords:
Cc: juho.manninen@…

Description

Profile layer names that point to the parent directory break localizations so that loading of the layer package fails:

  • name: "mylayer.js" - works
  • name: "../dojox/mylayer.js"- works
  • name: "../my/layer.js"- breaks already in the build (no directory)
  • name: "../mylayer.js" - breaks the package

It breaks mylayer.js package by omitting the layer name, like:

dojo.i18n._preloadLocalizations("dojo.nls.", ["ROOT", "en-us", "en", "xx"]);

Attachments

breakLocalizations.profile.js (0.7 kB) - added by guest 12 months ago.
Sample build profile that creates a layer file with broken _preloadLocalizations

Change History

  Changed 12 months ago by jburke

Could I get some more information about the issue? Looking at the code, it seems like if you did not specify the "my" directory in the prefixes area of the build profile, that could cause problems. The build system needs to know about any sort of directory that will contain JS module files or layers.

Maybe a sample build profile (you can attach one via the Attach File button above) might help me understand what you want to happen.

Changed 12 months ago by guest

Sample build profile that creates a layer file with broken _preloadLocalizations

follow-up: ↓ 3   Changed 12 months ago by guest

I attached a simple build profile that illustrates the problem.

It creates the build and the layer - no problem here, but the very last line in the layer file "broken.js.uncompressed.js" is malformed:

dojo.i18n._preloadLocalizations("dojo.nls.", ["fi", "se-se", "ROOT", "se", "en-us", "fi-fi", "en", "en-gb", "xx"]);

Note the missing layer name! Trying to load the layer leads to js error when it tries to load localizations.

The third case on my list ("my" directory) is sort of a separate issue that I noticed when I tried to solve the problem. _preloadLocalizations call is created correctly as long as there's any directory in the layer name.

in reply to: ↑ 2   Changed 12 months ago by guest

Just to clarify:

The third case on my list (missing "my" directory) is sort of a separate issue that I noticed when I tried to solve the problem. _preloadLocalizations call is created correctly as long as there's any existing directory (dojo/dojox) in the layer name (name: "../dojo/ok.js" works fine).

  Changed 12 months ago by jburke

  • status changed from new to closed
  • resolution set to fixed

(In [11794]) Fixes #5225: could not create layers in directories that did not exist in the module prefix directories. Now it works. We cannot support layer names of '../layername.js' but now we can support name: 'layers/layername.js' which will map to release dir, dojo/layers/layername.js and the preloadlocalization calls should work in that case.

  Changed 12 months ago by jburke

(In [11795]) Fixes #5225: could not create layers in directories that did not exist in the module prefix directories. Now it works. We cannot support layer names of '../layername.js' but now we can support name: 'layers/layername.js' which will map to release dir, dojo/layers/layername.js and the preloadlocalization calls should work in that case. (merge to trunk)

  Changed 12 months ago by jburke

Thanks for the test case, that helped a lot. It turns out we cannot support layers with names of "../broken.js" that also use i18n bundles. We need to be able to map the bundle path to a resource name, a dot-notation name like my.broken. However, since ".." is not mapped to any logical name (and there would be problems defining that mapping since that directory includes other module path mappings), there is a problem.

If you have your own custom modules in your "my" directory, you can put the layers in there, and make sure the prefixes section includes a my mapping directory (but make sure you do not map it to the ".." directory, since that directory also contains dojo, dijit, etc..)

I did fix the problem about not being able to create new directories though, so if you do not have your own custom modules in a separate directory, you can now do a name: "layers/layername.js", and this will be saved in the release dir's dojo/layers/ directory (with i18n resources in dojo/layers/nls).

So for the test build profile, if you get the latest code and use name: "layers/broken.js", it should now work.

Note: See TracTickets for help on using tickets.