Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 2 i18n国际化:message.xlf为空_Angular_Internationalization - Fatal编程技术网

Angular 2 i18n国际化:message.xlf为空

Angular 2 i18n国际化:message.xlf为空,angular,internationalization,Angular,Internationalization,我一直遵循国际化的角度食谱: 经过长时间的依赖调试,我成功地生成了message.xlf文件,没有任何错误,但是, 未提取任何内容,xlf为空 似乎在我的标签中看不到i18n 有人设法解决了这个问题吗 message.xlf 我面临同样的问题,在我的例子中是angular compiler+typescript 2.1.4,回滚到版本2.0.10解决了这个问题。在我的例子中,我必须用参数-p path/to/tsconfig.json启动ng-xi18n,因为我的ts源文件不在根目录中,它们在

我一直遵循国际化的角度食谱:

经过长时间的依赖调试,我成功地生成了message.xlf文件,没有任何错误,但是, 未提取任何内容,xlf为空

似乎在我的标签中看不到i18n

有人设法解决了这个问题吗

message.xlf



我面临同样的问题,在我的例子中是angular compiler+typescript 2.1.4,回滚到版本2.0.10解决了这个问题。

在我的例子中,我必须用参数-p path/to/tsconfig.json启动ng-xi18n,因为我的ts源文件不在根目录中,它们在单独的目录中(src/client/,我使用了-seed@mgechev从头开始项目)。 我的意思是package.json中的i18n任务看起来像:

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


将在src/client目录中生成messages.xlf。

我遇到了完全相同的问题,并通过在angular.json中设置配置解决了它,如下所示:

        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "<projectName>:build:<configuration>"
          }
         },
“extract-i18n”:{
“构建器”:“@angular devkit/build angular:extract-i18n”,
“选择”:{
browserTarget::生成:
}
},
其中:

  • projectName:您的项目的名称
  • 配置:“配置”部分中提供的配置名称

谢谢!这确实是typescript的版本问题,我卸载了它并安装了2.0.8版本,它可以正常工作
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "<projectName>:build:<configuration>"
          }
         },