An unhandled exception occurred: The development server only supports localizing a single...

Discussão em 'Angular' iniciado por urasavidi, Março 27, 2025.

  1. urasavidi

    urasavidi Guest

    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"
    }
    }
    }

    Continue reading...

Compartilhe esta Página