{"record":{"id":"6da8a329b1e23c93","repo":"angular/angular-cli","slug":"localization-currently-only-supports-using-one-typ","errorCode":null,"errorMessage":"Localization currently only supports using one type of translation file format for the entire application.","messagePattern":"Localization currently only supports using one type of translation file format for the entire application\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/utils/i18n-webpack.ts","lineNumber":112,"sourceCode":"      locale,\n      desc,\n      context.workspaceRoot,\n      loader,\n      {\n        warn(message) {\n          context.logger.warn(message);\n        },\n        error(message) {\n          throw new Error(message);\n        },\n      },\n      usedFormats,\n      buildOptions.i18nDuplicateTranslation,\n    );\n\n    if (usedFormats.size > 1 && tsConfig.options.enableI18nLegacyMessageIdFormat !== false) {\n      // This limitation is only for legacy message id support (defaults to true as of 9.0)\n      throw new Error(\n        'Localization currently only supports using one type of translation file format for the entire application.',\n      );\n    }\n  }\n\n  // If inlining store the output in a temporary location to facilitate post-processing\n  if (i18n.shouldInline) {\n    // TODO: we should likely save these in the .angular directory in the next major version.\n    // We'd need to do a migration to add the temp directory to gitignore.\n    const tempPath = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'angular-cli-i18n-'));\n    buildOptions.outputPath = tempPath;\n\n    process.on('exit', () => {\n      try {\n        fs.rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });\n      } catch {}\n    });\n  }","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/utils/i18n-webpack.ts#L94-L130","documentation":"Legacy message ID format (pre-Ivy, computed from meaning/description) collides when translations mix file formats, because each format generates legacy IDs differently. If more than one translation file format (xlf, xlf2, xtb, json/arb) is used while legacy message IDs are enabled (enableI18nLegacyMessageIdFormat not false), the build throws.","triggerScenarios":"`localize` configured with translation files of different formats (e.g. one XLIFF 1.2 file and one XLIFF 2.0 or JSON file) while tsconfig does not set \"enableI18nLegacyMessageIdFormat\": false.","commonSituations":"Teams migrating translation files from one format to another with mixed leftovers; adding a new locale supplied in a different format by a vendor; older projects relying on legacy message IDs adding a new language file.","solutions":["Convert all translation files to a single format (e.g. all XLIFF 1.2).","Set \"enableI18nLegacyMessageIdFormat\": false in tsconfig compilerOptions to use modern IDs (requires your translation files use modern $localize message IDs).","Regenerate/extract messages (ng extract-i18n) and re-translate in one unified format.","Split the build so each format is used in separate applications if unification isn't possible."],"exampleFix":"// before (tsconfig.json)\n{\"compilerOptions\": {}}\n// after\n{\"compilerOptions\": { \"enableI18nLegacyMessageIdFormat\": false }}","handlingStrategy":"validation","validationCode":"const formats = new Set(localeFiles.map(f => /\\.xlf2?$|\\.xliff/.test(f) ? (f.endsWith('2')||f.includes('xlf2') ? 'xlf2' : 'xlf') : /\\.xtb$/.test(f) ? 'xtb' : 'json'));\nif (formats.size > 1) throw new Error('All translation files must use one format while legacy message IDs are enabled.');","typeGuard":null,"tryCatchPattern":"try {\n  await configureI18nBuild(context, options);\n} catch (err) {\n  if (err.message.includes('only supports using one type of translation file format')) {\n    console.error('Unify translation file formats or set enableI18nLegacyMessageIdFormat: false in tsconfig.');\n  } else throw err;\n}","preventionTips":["Standardize on one translation format (e.g. XLIFF 1.2) across all locales.","Set enableI18nLegacyMessageIdFormat: false when using modern $localize IDs.","Enforce format checks in CI before builds with localization.","Re-extract messages with ng extract-i18n after format migration."],"tags":["i18n","translation-files","configuration"],"backgroundTag":"mixed-translation-formats","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}