小编Avi*_*Avi的帖子

Angular 9 国际化 - 请求的语言环境错误

我正在 Angular 9 中使用新的国际化方式创建一个新应用程序。当我运行命令时ng serve --configuration=en ,出现以下错误 -

发生未处理的异常:未为项目定义请求的语言环境“en”。

我已经验证了 xlf 文件位置。存在区域设置文件。应用程序在没有配置参数的情况下运行良好。我的项目的 Angular.json -

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "khelFever2": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        },
        "i18n": {
          "locales": {
            "en": "src/locale/messages.en.xlf",
            "hi": "src/locale/messages.hi.xlf"
          }
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/khelFever2",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "aot": true,
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.scss", …
Run Code Online (Sandbox Code Playgroud)

internationalization angular

2
推荐指数
1
解决办法
1715
查看次数

标签 统计

angular ×1

internationalization ×1