{"record":{"id":"d4482b72623f3c05","repo":"angular/angular-cli","slug":"message","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/utils/i18n-webpack.ts","lineNumber":103,"sourceCode":"    }\n\n    if (!desc.files.length) {\n      continue;\n    }\n\n    loader ??= await createTranslationLoader();\n\n    loadTranslations(\n      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.","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/utils/i18n-webpack.ts#L85-L121","documentation":"During i18n inlining, duplicate translation detection reports issues via a warn/error callback. The error callback rethrows the message as an Error, so duplicate-translation problems configured as errors abort the build with the translator's message verbatim.","triggerScenarios":"`i18nDuplicateTranslation` set to 'error' (the default in many versions) while the same translation key/messageId appears more than once in translation files (e.g. duplicate <trans-unit> ids or repeated meaning/description pairs) across locale files loaded via makeTranslationLoader.","commonSituations":"Merging translation files from multiple translators; duplicated trans-unit IDs after CAT-tool exports; multiple translation files (glob patterns) containing overlapping units; upgrading and enabling stricter duplicate checks.","solutions":["Deduplicate the translation units in your locale files (unique ids/keys).","Set \"i18nDuplicateTranslation\": \"warning\" (or \"ignore\") in angular.json i18n options to downgrade the behavior.","Split overlapping translation files or restrict your translation file globs so each unit appears once.","Rename duplicate trans-unit ids in XLIFF or remove repeated messages in XTB/JSON files."],"exampleFix":"// before (angular.json)\n\"i18n\": { \"duplicateTranslation\": \"error\" }\n// after\n\"i18n\": { \"duplicateTranslation\": \"warning\" }","handlingStrategy":"try-catch","validationCode":"const seen = new Set();\nfor (const unit of translationUnits) {\n  if (seen.has(unit.id)) console.warn(`Duplicate translation unit: ${unit.id}`);\n  seen.add(unit.id);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await configureI18nBuild(context, options);\n} catch (err) {\n  // message is the raw duplicate-translation report\n  if (/duplicate/i.test(err.message)) {\n    console.error('Deduplicate trans-unit ids/keys in locale files or set i18nDuplicateTranslation to \"warning\".');\n  } else throw err;\n}","preventionTips":["Set i18nDuplicateTranslation to 'warning' if duplicates are acceptable in your workflow.","Run a lint step that checks for duplicate trans-unit ids in XLIFF/JSON files.","Restrict translation file globs so the same unit isn't loaded twice.","Deduplicate after CAT-tool exports before committing locale files."],"tags":["i18n","translations","duplicates"],"backgroundTag":"duplicate-translation-key","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}