如何让 xliffmerge 与 Angular 8 一起工作?

Phi*_*ges 3 angular-i18n angular

正如文档中所写,我已经安装了 @ngx-i18nsupport 的工具: 在此输入图像描述

设置所有内容,并在 package.json 文件中添加以下脚本:

"extract-i18n": "ng xi18n IOCheck --i18n-format xlf 
--output-path i18n --i18n-locale fr && xliffmerge"
Run Code Online (Sandbox Code Playgroud)

运行脚本时,我收到以下错误消息:

An unhandled exception occurred: No projects support the 'extract-i18n' target.
See "/private/var/folders/3v/77qlrbxn15174h43y9qs7v8w0000gn/T/ng-TFnOne/angular-errors.log" for further details.
Run Code Online (Sandbox Code Playgroud)

所以我检查了 angular.json 并且该文件看起来没问题:

角度.json

xliffmerge 在命令行中工作正常...任何帮助将不胜感激。

谢谢

小智 5

它的翻译工作基于这种方式

现在您将在 src/i18n 下找到 3 个文件

1)messages.xlf:包含应用程序中找到的所有消息的主文件。

2)messages.de.xlf:德语版本。

3)messages.en.xlf:(目前尚未翻译)英文版本。

包裹:package.json

{
  [...]
  "scripts": {
    [...]
    "extract-i18n": ...,
    "start-en": "ng serve --configuration=en"
  }
  [...]
}
Run Code Online (Sandbox Code Playgroud)

角度:angular.json

.."build": {
    "configurations": {
..
            "en": {
              "aot": true,
              "outputPath": "dist/sampleapp-en",
              "i18nFile": "src/i18n/messages.en.xlf",
              "i18nFormat": "xlf",
              "i18nLocale": "en"
            }
.."serve": {
..
          "configurations": {
..
            "en": {
              "browserTarget": "sampleapp:build:en"
            }
Run Code Online (Sandbox Code Playgroud)

跑步

npm run start-en

有关更多信息,请查看此链接xliffmerge