[英]Angular2 ng-xi18n: Does not work
I tried many solution tips for using ng-xi18n. 我尝试了很多使用ng-xi18n的解决方案提示。
the steps I have done was to uninstall/remove node_modules and installed angular-cli again with npm install --save @angular/cli. 我所做的步骤是卸载/删除node_modules并使用npm install再次安装angular-cli --save @ angular / cli。 and with the last step npm install to get the dependencies.
并使用最后一步npm install来获取依赖项。
But everytime I execute npm run i18n I get an error. 但每次我执行npm run i18n我都会收到错误。
package.json: 的package.json:
{
...
"i18n": "ng-xi18n --i18nFormat=xmb",
...
},
"devDependencies": {
"@angular/cli": "^1.0.0-rc.4",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
...
"tslint": "~4.5.0",
"typescript": "^2.0.0"
}
}
ng --version: ng --version:
@angular/cli: 1.0.0-rc.4 node: 7.7.3 @angular / cli:1.0.0-rc.4节点:7.7.3
My error: 我的错误:
Error: Error encountered resolving symbol values statically. 错误:静态解析符号值时遇到错误。 Expression form not supported .. resolving symbol AppModule in ode_modules/@angular/cli/blueprints/ng/files/ path /app/app.module.ts
表达形式不受支持..在ode_modules / @ angular / cli / blueprints / ng / files / path /app/app.module.ts中解析符号AppModule
I hope someone experienced the same problem and can help me. 我希望有人遇到同样的问题,可以帮助我。
Thx. 谢谢。
I'm not sure if this will solve your problem, but I had a similar error and needed to point ng-xi18n to my tsconfig.json file. 我不确定这是否能解决您的问题,但我遇到了类似的错误,需要将ng-xi18n指向我的tsconfig.json文件。 In my case I needed to run:
在我的情况下,我需要运行:
./node_modules/.bin/ng-xi18n -p src/tsconfig.json
You might need to change your package.json file 您可能需要更改package.json文件
{
...
"i18n": "ng-xi18n --i18nFormat=xmb -p path/to/tsconfig.json",
...
},
https://angular.io/docs/ts/latest/cookbook/i18n.html#!#other-options https://angular.io/docs/ts/latest/cookbook/i18n.html#!#other-options
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.