我的问题,虽然起初有点类似于 this one,但似乎是一个更基本的问题 – 可能是构建系统中的一个错误信号.我为我的dojo应用程序创建了一个自定义构建.我现在只构建一个图层,这是配置文
dependencies = { stripConsole: "all", action: "release", optimize: "shrinksafe", releaseName: "myProject", // list of locales we want to expose localeList: "en-gb,en-us,de-de", layers: [ { // Name: a relative path from the dojo.js in the desination directory. name: "../../myProject.js", dependencies: [ "myPackage.MyDataStore", // MyWidget depends on a few other widgets, and has its own // translation files. "myPackage.MyWidget" ] } ], prefixes: [ // These paths are relative to the location of dojo.js [ "dijit", "../dijit" ], [ "dojox", "../dojox" ], [ "myPackage", "../../../src/myPackage" ] ] }
当我使用该描述运行构建时,它将输出以下目录结构中的文件:
release/ release/myProject/ release/myProject/dijit/ ... dijit ... release/myProject/dojo/ ... dojo ... release/myProject/dojox/ ... dojox ... release/myProject/myPackage/ ... my custom package ... release/nls/ myProject_en-us.js myProject_de.js etc.. ../myproject.js ../myProject.js.uncompressed.js
最后,在我的测试HTML页面中 – 我有以下内容:
<script type="text/javascript"> var djConfig = { debug: true, parseOnLoad: false, modulePaths: { // paths to directories in relation to dojo's location.... hurr. 'myPackage': '../myPackage', 'dojox': '../dojox', 'dijit': '../dijit' } }; </script> <script type="text/javascript" src="./release/myProject/dojo/dojo.js.uncompressed.js"></script> <script type="text/javascript" src="./release/myProject.js.uncompressed.js"></script> <script type="text/javascript"> dojo.addOnLoad(function(){ dojo.require('myPackage.MyDataStore'); dojo.require('myPackage.MyWidget'); var store = new myPackage.MyDataStore(); var widget = new myPackage.MyWidget({ store: store }, dojo.byId('testWidget')); widget.startup(); }); </script>
但不幸的是,Firebug向我吐了出来:
Bundle not found: MyWidget in myPackage , locale=en-us
我认为发生了什么
我已经跟踪了导致上述错误的一些代码,似乎文件末尾的dojo.i18n._preloadLocalizations()调用实际上没有从./release/nls加载到正确的nls文件中.
知道如何解决这个问题,而无需手动将nls文件包含在< script>中.标签?
这是dojo的一个错误,你不应该在你的图层名称中使用’..’,以防它生成一个NLS包.请参考http://bugs.dojotoolkit.org/ticket/5225