angular/angular-cli · error · Error
Localization currently only supports using one type of trans
Error message
Localization currently only supports using one type of translation file format for the entire application.
What it means
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.
Source
Thrown at packages/angular_devkit/build_angular/src/utils/i18n-webpack.ts:112
locale,
desc,
context.workspaceRoot,
loader,
{
warn(message) {
context.logger.warn(message);
},
error(message) {
throw new Error(message);
},
},
usedFormats,
buildOptions.i18nDuplicateTranslation,
);
if (usedFormats.size > 1 && tsConfig.options.enableI18nLegacyMessageIdFormat !== false) {
// This limitation is only for legacy message id support (defaults to true as of 9.0)
throw new Error(
'Localization currently only supports using one type of translation file format for the entire application.',
);
}
}
// If inlining store the output in a temporary location to facilitate post-processing
if (i18n.shouldInline) {
// TODO: we should likely save these in the .angular directory in the next major version.
// We'd need to do a migration to add the temp directory to gitignore.
const tempPath = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'angular-cli-i18n-'));
buildOptions.outputPath = tempPath;
process.on('exit', () => {
try {
fs.rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
} catch {}
});
}View on GitHub (pinned to bb72145f9a)
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.
Example fix
// before (tsconfig.json)
{"compilerOptions": {}}
// after
{"compilerOptions": { "enableI18nLegacyMessageIdFormat": false }} Defensive patterns
Strategy: validation
Validate before calling
const formats = new Set(localeFiles.map(f => /\.xlf2?$|\.xliff/.test(f) ? (f.endsWith('2')||f.includes('xlf2') ? 'xlf2' : 'xlf') : /\.xtb$/.test(f) ? 'xtb' : 'json'));
if (formats.size > 1) throw new Error('All translation files must use one format while legacy message IDs are enabled.'); Try / catch
try {
await configureI18nBuild(context, options);
} catch (err) {
if (err.message.includes('only supports using one type of translation file format')) {
console.error('Unify translation file formats or set enableI18nLegacyMessageIdFormat: false in tsconfig.');
} else throw err;
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Related errors
- The builder requires a target.
- Flat output is only supported when inlining one locale.
- Locale data for '${locale}' cannot be found. No locale data
- No project name provided and no default project found in wor
- Unsupported package manager: "${name}"
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/6da8a329b1e23c93.
Report an issue: GitHub.