angular/angular-cli · warning

*

Error message

*

What it means

This `warn` function is the logger adapter passed into `loadTranslations` for i18n locale processing; `"*"` denotes it forwards whatever message the translation loader produces. Any warning raised while loading/transpiling locale translation files (XLIFF/XTB parsing, missing translation units, format issues) is surfaced through this callback and added as a webpack compilation warning.

Source

Thrown at packages/angular_devkit/build_angular/src/builders/dev-server/webpack-server.ts:360

  }

  rules.push(i18nRule);

  // Add a plugin to reload translation files on rebuilds
  const loader = await createTranslationLoader();
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  webpackConfig.plugins!.push({
    apply: (compiler: webpack.Compiler) => {
      compiler.hooks.thisCompilation.tap('build-angular', (compilation) => {
        if (i18n.shouldInline && i18nLoaderOptions.translation === undefined) {
          // Reload translations
          loadTranslations(
            locale,
            localeDescription,
            context.workspaceRoot,
            loader,
            {
              warn(message) {
                addWarning(compilation, message);
              },
              error(message) {
                addError(compilation, message);
              },
            },
            undefined,
            browserOptions.i18nDuplicateTranslation,
          );

          i18nLoaderOptions.translation = localeDescription.translation ?? {};
        }

        compilation.hooks.finishModules.tap('build-angular', () => {
          // After loaders are finished, clear out the now unneeded translations
          i18nLoaderOptions.translation = undefined;
        });
      });

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Read the forwarded warning message in the build output to identify the specific translation unit/file
  2. Re-run `ng extract-i18n` and re-translate/review the changed units in the XLIFF files
  3. Validate translation files with an XLIFF linter or XML schema validator
  4. Ensure every `$localize`-tagged string in source has a corresponding translation unit for each locale

Example fix

// before (angular.json i18n)
"locales": { "fr": "src/locale/messages.fr.xlf" } // stale file missing new units
// after
ng extract-i18n --output-path src/locale
// then merge new units into messages.fr.xlf
Defensive patterns

Strategy: validation

Validate before calling

// validate translation files before building with i18n locales
import { readFileSync } from 'fs';
for (const file of localeFiles) {
  const xml = readFileSync(file, 'utf8');
  if (!xml.includes('<xliff') && !xml.includes('<xlf')) {
    console.warn(`${file} does not look like a valid XLIFF document`);
  }
}

Try / catch

// server-side: warnings are forwarded to the webpack logger, not thrown
compiler.hooks.afterCompile.tap('checkWarnings', (compilation) => {
  compilation.warnings
    .filter((w) => String(w).includes('Translation') || String(w).includes('i18n'))
    .forEach((w) => console.warn('i18n warning:', String(w)));
});

Prevention

When it happens

Trigger: Configured i18n locales in angular.json where a translation file contains issues — missing translation keys referenced by `$localize` tags, malformed XLIFF/XTB XML, or locale data mismatches — while running serve or build with translations.

Common situations: A translation file is out of date with source templates after adding new i18n-marked text; a translator hand-edited XLIFF and broke a unit; ICU plural/select syntax errors in translations.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/6d82f66fc0ac1f5a. Report an issue: GitHub.