Angular 2 i18n-internationalisation : message.xlf is empty

◇◆丶佛笑我妖孽 提交于 2019-12-23 23:52:42

问题


I 've been following the angular cookbook for internationalization : https://angular.io/docs/ts/latest/cookbook/i18n.html#!#angular-i18n

after a long dependency debugging time, i manage to generate a message.xlf file, without any error but, nothing has been extracted, the xlf is empty.

it seems to not see the i18n in my tags...

is there anyone who managed to solve this?

message.xlf

<?xml version="1.0" encoding="UTF-8" ?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> <file source-language="en" datatype="plaintext" original="ng2.template"> <body> </body> </file> </xliff>


回答1:


I face the same problem, in my case was the angular compiler + typescript 2.1.4, rollback to version 2.0.10 solves the problem.




回答2:


In my case thing was in that I have to start ng-xi18n with parametr '-p path/to/tsconfig.json', because my ts-source files are not in the root, they are in separate directory (src/client/, I've used angular-seed@mgechev to start project from scratch). I mean my i18n task in package.json looks like:

"i18n": "ng-xi18n -p src/client/tsconfig.json"

then

$ npm run i18n

will generate messages.xlf in src/client directory.



来源:https://stackoverflow.com/questions/41143020/angular-2-i18n-internationalisation-message-xlf-is-empty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!