道场自定义生成与NLS /本地化 [英] Dojo custom build with NLS / localisation

查看:243
本文介绍了道场自定义生成与NLS /本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有实现跨域自定义生成Dojo中的一个问题。
情况如下:我有一个pretty大型应用程序,具有良好的本地化数捆,所以basicly的目录结构就像是

核心\\(我的模块)

    NLS \\

       FR \\

       EN \\

      ....

在构建我的模块的结果是一个大core.js / core.xd.js文件,其中,边河畔,不包含的本地化。在本地化NLS目录(EN / FR /等)我构建每捆建造/缩小的,并为每种语言,core_fr.js / core_en.fs一个更大的文件,该文件只包含道场/ Dijit的相关字符串后找到的。

I have a problem implementing a cross domain custom build in Dojo. The situation is as follows: i have a pretty large application, with a good number of localisation bundles, so basicly the directory structures is like
core\ (my module)
nls\
fr\
en\
....
When building my module the result is a big core.js/core.xd.js file, which, bien sur, does not contain the localisations. In the localisation nls directories (en/fr/etc) i find after the build each bundle builded/minified, and a bigger file for each language, core_fr.js/core_en.fs, which contains only Dojo/Dijit related strings.

所以我的构建脚本是

            layers: [
            {
	resourceName: "core",
            name: "../core/trusted.js",
            dependencies: [
                      "dojo.i18n",
                      //data
                      "dojox.data.JsonRestStore",
                      "dojox.data.XmlStore",
                      "dojox.rpc.Service",
                      "dojox.form.FileInput",
                       ...
                      "core.controller.Fusebox"                        
],
                  prefixes: [
             	["dijit","../dijit"],
        	["dojox","../dojox"],
                    ["core", "../core"]
                  ]

在core.controller.Fusebox类我尝试加载1 NLS

In the core.controller.Fusebox class i try to load 1 nls

dojo["requireLocalization"]("core", "FuseboxContent");

在这里会死,但以

here it will die, however with

availableFlatLocales is undefined
[Break on this error] var locales = availableFlatLocales.split(",");\r\n

我在HTML文件中的配置是:

My config in the html file is :

// version build
  var djConfig = {
    baseUrl: 'https://..../',
    modulePaths: { 'core': 'core'},
    useXDomain: true,
    xdWaitSeconds: 10,
    parseOnLoad: true,
    afterOnLoad: true,
//  debugAtAllCosts: true,
    isDebug: true,
    locale: "fr"
  };

然后

<script type="text/javascript" src="http://xd.woopic.com/dojoroot/1.3.2-xd/dojo/dojo.xd.js.uncompressed.js"></script> 
<script type="text/javascript" src="https://..../core/trusted.js.uncompressed.js"></script>

我用pssed调试,当然uncom $ P $。
问题是,在运行时,道场尝试加载我的包,无法找到他们,我想将它们嵌入在我的图层文件,所以没有多余的负荷是必需的。
才能实现这一目标?虽然我们在这,是否有交叉领域的本地化工作的任何网站/例子吗?
更新:我继续我的分析,这个问题似乎在事实上,我正在dynamicaly加载NLS打好,所以构建解析器找不到requireLocalization()调用。因此,该项目的NLS文件只包含道场/ dijit的相关内容。然而,我加入一个虚拟文件几束负载和核心/ NLS的内容仍然由制造商忽略。

I used the uncompressed for debug, of course. The problem is that, on runtime, Dojo tries to load my bundles and can not find them, and i would like to embed them in my layer file, so no extra loads will be required. Can this be achieved? And while we're at it, are there any working sites/examples with cross domain localisations? UPDATE: i continued my analysis and the problem seems to lay in the fact that i am dynamicaly loading nls, so the build parser can not find the requireLocalization() calls. Therefore the project nls file contains only dojo/dijit related content. However, i added a few bundle loads in a dummy file, and the content of core/nls is still ignored by the builder.

感谢您的任何信息,我是pretty很多在我的搜索结束时,没有太多关于这个主题的净值。

Thanks for any info, i am pretty much at the end of my searches, there isn't much on the net on this subject.

推荐答案

我有一个类似的问题,前几天。首先,你可以通过设置可用的语言环境作为requireLocalization调用的第四个参数避开错误。

I had a similar issue a few days ago. First of all, you can get around the error by setting the available locales as the 4th parameter of the requireLocalization call.

例如

dojo.requireLocalization("core", "FuseboxContent", null, "en,fr");

但你不应该这样做。

though you should not have to do that.

您是否尝试过包括本地化如下?

Did you try including the localization as follows?

dojo.requireLocalization("core", "FuseboxContent"); // and not dojo["require..."]

这篇关于道场自定义生成与NLS /本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆