简体   繁体   English

在Angular库上运行ng xi18n以生成messages.xlf会引发错误

[英]Running ng xi18n to generate messages.xlf on angular library throws error

I have a library component and I want to add internationalization feature to it. 我有一个库组件,我想为其添加国际化功能。 Therefore my html looks as follows for the tag I want internationalization to be applied. 因此,对于要应用国际化的标签,我的html如下所示。

<div><span i18n="site header|Application version@@AppVersion" class="appversion">Version: {{version}}</span></div>

I have added the extract-i18n tag to the angular.json for my project(angular library) part of angular json configuration corresponding to project(tile library) 我已经将我的extract-i18n标记添加到与项目(tile库)相对应的angular json配置的我的project(angular库) 部分的angular.json中

When I try to run ng xi18n tile [tile is my angular library name], it throws an error as follows: Error on running ng xi18n tile . 当我尝试运行ng xi18n tile [tile是我的角度库名称]时,它引发如下错误运行ng xi18n tile时出错

I already tried debuggin the libraries and it seems that common.js under 'angular-cli-files\\models\\webpack-configs' is needing in its buildOptions Output Path, but when I add output path to angular.json as in screenshot, error is thrown(this error means that the option is invalid). 我已经尝试调试这些库,并且似乎在“ angular-cli-files \\ models \\ webpack-configs”下的common.js需要在其buildOptions输出路径中使用,但是当我将输出路径添加到angular.json中时(如屏幕截图所示),错误被抛出(此错误表示该选项无效)。 Error after adding outputPath in the options for the project . 在项目的选项中添加outputPath后出错

Can anyone tell me how can this be fixed or are there any additional settings in the configs that I need to apply internationalization to angular libraries? 谁能告诉我如何解决此问题,或者在配置中是否需要对角库应用国际化的其他设置?

Additional info: ng-version I am able to run the internationalization on my angular main project but not able to on the my libraries. 附加信息: ng-version我可以在我的angular主项目上运行国际化,但不能在我的库上运行。

I have a similar problem before but from your question, I dont know why you run xi18n tile . 我之前也有类似的问题,但是从您的问题run xi18n tile ,我不知道您为什么要run xi18n tile u should just run ng xi18n 你应该只运行ng xi18n

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

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