'An unhandled exception occurred: The development server only supports localizing a single locale per build

Please advise how this error can be fixed, I'm trying to implement localization but having this issue. Guide I used: https://angular.io/guide/i18n#merge-translations-into-the-app If it will help, I was able to run using ng serve --configuration=ru --open and app was localized, but after I used _build.bat it broke my app and I cannot run it anymore at all. If I specify different port it throws an error "NGCC failed". Here's example of my code from angular.json file:

"projects": {
"operator": {
   "i18n": {
        "sourceLocale": "en-US",
        "locales": {
          "ru": "src/locale/messages.ru.xlf"
        }
   },
  "projectType": "application",
  "schematics": {},
  "root": "",
  "sourceRoot": "src",
  "prefix": "app",
  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/operator",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "aot": true,
        "localize": true,
        "assets": [
          "src/favicon.ico",
          "src/assets"
        ],
        "styles": [
          "src/styles.css"
        ],
        "scripts": ["src/version.js"]
      },
      "configurations": {
        "ru": {
            "localize": ["ru"]
        },
        "production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "budgets": [
            {
              "type": "initial",
              "maximumWarning": "3mb",
              "maximumError": "5mb"
            },
            {
              "type": "anyComponentStyle",
              "maximumWarning": "6kb",
              "maximumError": "10kb"
            }
          ]
        }
      }
    },
    "serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "operator:build"
      },
      "configurations": {
        "production": {
          "browserTarget": "operator:build:production"
        },
        "ru": {
            "browserTarget": "operator:build:ru"
        }
      }
    }


Solution 1:[1]

After I removed "localize": true, error never showed up.

Solution 2:[2]

It is because you are missing the locale configuration to start the application.

You should add --configuration=en after ng serve. Don't forget to replace en with the desired language.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 urasavidi
Solution 2 Jöcker