我试图用JiT和angular-cli 学习本教程.我在浏览器控制台中遇到以下错误,但终端没有错误来运行/构建应用程序.
未捕获的ReferenceError:系统未定义(...)
未捕获错误:找不到模块'./locale/messages.fr.xlf!text'.(...)
我的代码在github https://github.com/sayedrakib/internationalization_project.git
我根据教程中的说明在根文件夹中添加了systemjs-text-plugin.js.文件结构

我想我已经搞砸了一些文件中的文件路径,因为我觉得教程中的假定文件结构和angular-cli创建的文件结构不一样.
我花了很长时间才弄清楚这一点!
如果您遵循文档,请更改此内容:
最后看起来像这样:
索引.html
<body>
<app-root>Loading...</app-root>
<script src="system.js"></script>
<script>
// Get the locale id somehow
document.locale = 'es';
// Map to the text plugin
SystemJS.config({
map: {
text: 'systemjs-text-plugin.js'
}
});
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
i18n-providers.ts
export function getTranslationProviders(): Promise<Object[]> {
[...]
}
declare let SystemJS: any;
function getTranslationsWithSystemJs(file: string) {
return SystemJS.import(file + '!text'); // relies on text plugin
}
Run Code Online (Sandbox Code Playgroud)
我打开了GitHub Issue来更新文档。