【问题标题】:Angular2 ng-xi18n: Does not workAngular2 ng-xi18n:不起作用
【发布时间】:2017-03-22 11:19:00
【问题描述】:

我尝试了许多使用 ng-xi18n 的解决方案提示。

我所做的步骤是卸载/删除 node_modules 并使用 npm install --save @angular/cli 再次安装 angular-cli。最后一步 npm install 来获取依赖项。

但是每次我执行 npm run i18n 都会出错。

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--版本:

@angular/cli: 1.0.0-rc.4 节点:7.7.3

我的错误:

错误:静态解析符号值时遇到错误。不支持表达式形式 .. 解析 ode_modules/@angular/cli/blueprints/ng/files/path/app/app.module.ts

中的符号 AppModule

我希望有人遇到同样的问题并可以帮助我。

谢谢。

【问题讨论】:

    标签: angular internationalization


    【解决方案1】:

    我不确定这是否能解决您的问题,但我遇到了类似的错误,需要将 ng-xi18n 指向我的 tsconfig.json 文件。就我而言,我需要运行:

    ./node_modules/.bin/ng-xi18n -p src/tsconfig.json

    您可能需要更改您的 package.json 文件

    {
        ...
        "i18n": "ng-xi18n --i18nFormat=xmb -p path/to/tsconfig.json",
        ...
    },
    

    https://angular.io/docs/ts/latest/cookbook/i18n.html#!#other-options

    【讨论】:

      猜你喜欢
      • 2017-07-25
      • 1970-01-01
      • 2017-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-20
      • 2017-07-08
      • 2017-04-20
      相关资源
      最近更新 更多