简体   繁体   English

Angular 9 中未加载单个 spa angular i18n 文件

[英]single spa angular i18n files are not loaded in Angular 9

I am creating micro frontend angular application using single spa.How can i load i18n files from assets folder.我正在使用单个 spa 创建微前端角度应用程序。如何从资产文件夹加载 i18n 文件。

I have followed the instructions from : https://single-spa.js.org/docs/ecosystem-angular/我已按照以下说明操作: https : //single-spa.js.org/docs/ecosystem-angular/

Angular Version : 9.1.12角度版本:9.1.12

Single spa : 4单人水疗中心:4

single spa angular: 4.4.2单温泉角度:4.4.2

在此处输入图片说明

Do we need to add some additional configuration in webpack so that it loads the i18n files from assets folder ?我们是否需要在 webpack 中添加一些额外的配置,以便它从资产文件夹加载 i18n 文件?

When you install single-spa library to your application, single-spa/assets-url.ts is generated.当您将 single-spa 库安装到您的应用程序时,会生成 single-spa/assets-url.ts。 You need to import asset-url.ts in your component and pass the path of i18n file in assetUrl method so that it will be available when you run the application.您需要在您的组件中导入 asset-url.ts 并在 assetUrl 方法中传递 i18n 文件的路径,以便在您运行应用程序时可以使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM