Skip to content

Fix i18n extraction silently skipping files that use await using - #4467

Draft
bcotrim wants to merge 1 commit into
trunkfrom
mognet/fix-pot-extraction-await-using
Draft

Fix i18n extraction silently skipping files that use await using#4467
bcotrim wants to merge 1 commit into
trunkfrom
mognet/fix-pot-extraction-await-using

Conversation

@bcotrim

@bcotrim bcotrim commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • None — found while auditing the string-extraction pipeline.

How AI was used in this PR

Claude Code traced the failure, wrote the fix, and re-ran extraction to verify. I reviewed the diff and the before/after msgid sets myself.

Proposed Changes

  • 62 translatable CLI strings never reached GlotPress. wp-babel-makepot transpiles every file with @babel/preset-env before extracting, and transform-block-scoping throws on await using. It skipped 9 files, logged the error, and still exited 0 — so code_freeze committed an incomplete .pot and reported success. Long-standing, not a recent regression.
  • Extraction only needs the AST (makepot sets code: false and discards the generated code), so targeting the current Node turns those downlevel transforms off entirely. A repo-level babel config can't fix this: makepot hardcodes its babel cwd to its own package directory and never reads one.
  • The lane now fails loudly if makepot logs a parse error, instead of silently shipping a short .pot.
  • No new dependency, no lockfile change.
  • The .pot is not regenerated here — code_freeze does that. Heads-up: the next run shows +472/−8 msgids, of which only 39 come from this fix; the rest is normal drift since the 1.17.0 freeze.

Testing Instructions

Before (on trunk):

npx wp-babel-makepot "$PWD/{apps/studio/src,apps/cli,apps/ui/src,packages/common}/**/*.{js,jsx,ts,tsx}" \
  --ignore "$PWD/apps/cli/node_modules/**/*,**/*.d.ts" --base "$PWD" --dir /tmp/pots --output /tmp/before.pot

9 BABEL_TRANSFORM_ERROR blocks, exit code 0. grep -c '^#: apps/cli/commands/config/set.ts:' /tmp/before.pot0.

After — same command with BROWSERSLIST='current node' prefixed and --output /tmp/after.pot: zero errors, and that same grep41. Across all 6 affected files: 0 → 62 call sites, with 0 msgids dropped.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

@bcotrim
bcotrim requested a review from a team as a code owner August 6, 2026 15:55
@bcotrim
bcotrim marked this pull request as draft August 6, 2026 15:56
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