Skip to content

fix(i18n): added missing support for i18nMissingTranslation option - #207

Open
jazzominy wants to merge 1 commit into
native-federation:mainfrom
jazzominy:fix/i18n-missing-translation
Open

jazzominy wants to merge 1 commit into
native-federation:mainfrom
jazzominy:fix/i18n-missing-translation

Conversation

@jazzominy

Copy link
Copy Markdown

Problem

The localize step for federation artifacts ignores the project's i18nMissingTranslation setting. translateFederationArtifacts runs localize-translate without -m/--missingTranslation, so the CLI always uses its default of warning.

So "i18nMissingTranslation": "ignore" or "error" only affects Angular's own bundles, not the federation artifacts:

  • with "ignore", every missing translation is still printed as a warning
  • with "error", the federation step doesn't fail

This is more than noise in large apps with many missing translations across several locales. The warnings are captured by execFileSync, and once they exceed its default 1 MB maxBuffer, the build fails:

An unhandled exception occurred: spawnSync C:\Program Files\nodejs\node.exe ENOBUFS

Change

  • translateFederationArtifacts takes an optional missingTranslation parameter, typed as ApplicationBuilderOptions['i18nMissingTranslation'], and passes it to localize-translate as -m. When it's unset, it defaults to warning, Angular's default, so behavior doesn't change for projects that don't set the option.
  • Both callers in builder.ts (the build path and the watch rebuild) pass ngBuilderOptions.i18nMissingTranslation.

Tests

  • i18n.spec.ts: -m gets each of error, warning and ignore, and defaults to warning when the option isn't set.
  • i18n.integration.spec.ts: with the real CLI, a missing translation fails the run under error and passes under ignore.

Verification

  • pnpm typecheck and pnpm lint pass, with no new warnings.
  • pnpm test: the new tests pass. I ran it on Windows, where 34 specs already fail on main, including 3 in i18n.spec.ts, because they expect POSIX paths. This PR doesn't add any failures.
  • I applied the same change on top of v22.2.4 and ran it against a real app with 5 locales. With i18nMissingTranslation: "ignore", the localized production build went from ENOBUFS to a clean build with all locale folders written.

Not included
With warning (the default), enough warnings can still overflow maxBuffer. A follow-up could stream the CLI's stderr instead of buffering it. It's kept separate so this PR stays focused.

Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant