使用Webpack的Angular2 i18n语言切换

Pau*_* D. 5 internationalization webpack angular

我希望在Angular 2应用程序中实现运行时语言环境切换。我找到了以下Angular2 i18n语言开关,其中包含使用SystemJS的解决方案https://plnkr.co/edit/JyE4l4TjEruuPsrbanmK。我的应用使用webpack。我正在尝试使用原始加载程序加载我的xlf文件,但收到“错误:找不到模块./i18n/messages.es.xlf”。我认为问题可能与i18n-providers.ts文件中的这段代码有关。

declare var System: any;

function getTranslationsWithSystemJs(file: string) {
  return System.import(file); // relies on text plugin
}
Run Code Online (Sandbox Code Playgroud)

如果使用webpack,我该如何替换前面的代码?