我想要做一些基本的国际化在我的应用程序木偶+国际化
我装了i18n的插件(从require.js)到我的应用程序和创建的目录nls
其中我有几个文件,例如project.js
我main.js
文件中设置的默认位置像
config : {
i18n : {
locale : 'de-de'
}
}
我现在想用在我看来/模板文件。有人可以向我解释这是如何完成的吗?这些模板安装在一个文件template.js
笔者认为:
define(['marionette', 'templates', 'i18n!nls/project'], function (marionette, templates, msg) {
return marionette.CompositeView.extend({
template : templates.project
});
});
我的模板:
<div class="container">
<div class="well">
<h2>Projects</h2>
</div>
</div>
有人能向我解释如何使用文件在我看来/模板?提前致谢!
编辑:
我想通了一些解决方案尝试&错误。正如我通过require.js tpl加载模板!插件我不需要编译它们,如果我打电话给他们require('tpl!templates/dashboard.tmpl')
。我可以简单地通过我加载的i18n文件'i18n!nls/dashboard'
。在木偶认为是默认渲染,所以我这样做:
define(['marionette', 'templates', 'i18n!nls/dashboard'], function (Marionette, templates, msg) {
return Marionette.CompositeView.extend({
template : function() {
return templates.dashboard(msg);
},
initialize : function() {
}
});
});
的国际化插件的文件以及这里解释: http://requirejs.org/docs/api.html#i18n
我不得不做这一步一步来,首先我错过根,然后我想知道为什么我的德语区域设置没有加载,但我只是忘了在根文件中设置de-de : true
。现在一切都像魅力
非常感谢你,我不得不做的事情有点不同,它帮助了我很多,我会在原始帖子中发布我的结果 – pfried 2013-02-11 08:51:20