{"record":{"id":"93dc7106f09b92b1","repo":"angular/angular-cli","slug":"the-development-server-only-supports-localizing-a","errorCode":null,"errorMessage":"The development server only supports localizing a single locale per build.","messagePattern":"The development server only supports localizing a single locale per build\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/dev-server/webpack-server.ts","lineNumber":148,"sourceCode":"    if (!config.devServer) {\n      throw new Error('Webpack Dev Server configuration was not set.');\n    }\n\n    let locale: string | undefined;\n    if (i18n.shouldInline) {\n      // Dev-server only supports one locale\n      locale = [...i18n.inlineLocales][0];\n    } else if (i18n.hasDefinedSourceLocale) {\n      // use source locale if not localizing\n      locale = i18n.sourceLocale;\n    }\n\n    let webpackConfig = config;\n\n    // If a locale is defined, setup localization\n    if (locale) {\n      if (i18n.inlineLocales.size > 1) {\n        throw new Error(\n          'The development server only supports localizing a single locale per build.',\n        );\n      }\n\n      await setupLocalize(\n        locale,\n        i18n,\n        browserOptions,\n        webpackConfig,\n        options.cacheOptions,\n        context,\n      );\n    }\n\n    if (transforms.webpackConfiguration) {\n      webpackConfig = await transforms.webpackConfiguration(webpackConfig);\n    }\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/dev-server/webpack-server.ts#L130-L166","documentation":"The webpack dev-server can only localize one locale per serve run, unlike the production build which can inline multiple locales. When i18n.shouldInline indicates localization and the set of inline locales has more than one entry, setup() throws because serving all localized variants simultaneously is not supported.","triggerScenarios":"angular.json (or CLI options) defines multiple localize locales for the build target and 'ng serve' is run without restricting to a single locale; passing --localize with several locales to the dev-server; a configuration that inherits i18n.locales with many entries while dev-server defaults to inlining all.","commonSituations":"Developers adding several locales (e.g. en, fr, de) for production and then running ng serve; CI jobs reusing production configurations (with multi-locale localize: true) for the dev-server; programmatic dev-server scheduling with a multi-locale buildTarget.","solutions":["Serve a single locale: run ng serve with --configuration referencing a config that limits localize to one locale, or set \"localize\": [\"fr\"] in the dev-server build target options.","Use buildTarget/configuration overrides in the serve target that restrict inline locales to one.","Do full multi-locale inlining only in the production build (ng build), not in serve.","Temporarily test other locales by re-running serve with a different single locale."],"exampleFix":"// before (angular.json serve/buildTarget options)\n\"localize\": true\n// after\n\"localize\": [\"fr\"]","handlingStrategy":"validation","validationCode":"import { getProjectI18nConfig } from './i18n-utils'; // or read angular.json i18n config\nconst inlineLocales = resolveInlineLocales(options); // your locale resolution\nif (inlineLocales.size > 1) {\n  throw new Error('Dev-server supports one locale; pass a single locale to localize.');\n}","typeGuard":"const isSingleLocale = (locales: Set<string>): locales is Set<string> & { size: 1 } => locales.size === 1;","tryCatchPattern":"try {\n  await ngServe();\n} catch (e) {\n  if (String(e.message).includes('single locale')) {\n    // rerun serve with one locale, e.g. localize: ['fr'] in serve options\n  }\n  throw e;\n}","preventionTips":["Never reuse multi-locale production configurations for serve","Set localize to a single-element array in dev-server buildTarget options","Reserve full multi-locale inlining for production builds","Document which locale each dev configuration serves"],"tags":["angular","dev-server","i18n","localization"],"backgroundTag":"multi-locale-serve-unsupported","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}