chore(i18n): drop the CI translation bot; agents translate in the PR

Merged
SA
2mo ago
+65-122285

What & why

The Translate Catalogs workflow filled missing translations with Claude and pushed a commit onto every PR that added a string. That left the agent's local branch behind its own PR and caused thrash. This removes it, along with the translator script and the Anthropic SDK dependency in packages/i18n. The agent that adds a string now writes its translations in the same change.

While here, the i18n check becomes trustworthy and linter-shaped:

  • Lingui runs through bunx --bun … --workers 1. The raw bin is a silent no-op under Node <22.18 (this is what every Mac with Node 22.16 gets), and under Bun's default worker pool compile --strict prints the error but exits 0. Single-threaded under Bun it exits 1 and, with --verbose, lists each missing id with its English source.
  • Root bun run check:i18n (extract + strict compile + stale-translation audit, ~7s) sits beside lint, typecheck, and test in CONTRIBUTING.md, DEVELOPMENT.md, and the ci-check command. The pretypecheck hook that re-ran extract on every typecheck is gone.
  • CI runs the same command plus a diff against HEAD, so uncommitted catalogs fail there and only there.
  • Catalogs carry no #: origin lines (origins: false), so the reference sorter that existed only to make those lines platform-independent is deleted. The 120k deleted catalog lines are exactly those comments; the compiled messages.ts files are unchanged.
  • The stale-translation audit was hardcoded to ja and zh-CN; it now covers every enabled locale.

A follow-up PR moves to Lingui's default text-as-id mode, which makes the stale audit unnecessary.

How I tested it

  • bun run check:i18n from a committed tree exits 0 in ~7s; with a German entry blanked, compile --strict --verbose --workers 1 exits 1 and names the id. The same blanked catalog exits 0 under the old bun run compile.
  • CI-form bun run check:i18n && git diff --exit-code --stat HEAD -- packages/i18n/locales exits 0 on the committed tree and 1 with a file list when catalogs are regenerated but uncommitted.
  • bun test in packages/i18n (111 pass), turbo typecheck --filter=@superset/i18n (now just tsc), biome on every changed file.
  • The deleted job is not in the main ruleset's required checks (Build, Test, Typecheck, Lint).

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs

https://claude.ai/code/session_013UiC9jnCiE3bpgg6YzPje1


Summary by cubic

Removes the Translate Catalogs CI workflow, which pushed generated translations onto PRs and left the author's branch out of sync. Authors now write translations for new strings in the same commit, and the i18n check reliably fails on missing or stale translations.

Changes

  • Root bun run check:i18n runs extract, strict compile, and the stale-translation audit; CI also fails if the regenerated catalogs differ from HEAD.
  • lingui runs via bunx --bun … --workers 1; the raw binary silently no-ops on older Node and exited 0 on failures under Bun's worker pool.
  • The pretypecheck extract hook is gone, and the stale audit now covers every enabled locale instead of only ja and zh-CN.
  • Catalogs no longer include #: origin lines, so the platform-dependent reference sorter is removed; the deleted catalog lines are comments only, and the compiled messages.ts files are unchanged.
  • The ci-check command runs the two fixers before the parallel checks, so check:i18n never reads a half-rewritten tree.
  • Removes the translator script and the @anthropic-ai/sdk dependency from packages/i18n.

Migration

  • After changing a user-facing string, run bun run check:i18n, write missing translations into each packages/i18n/locales/<locale>/messages.po, and commit the regenerated catalogs.

Summary by CodeRabbit

  • Documentation

    • Updated localization guidance with a unified command for regenerating and checking translation catalogs.
    • Clarified translation ID conventions, stale-translation handling, catalog determinism, and contributor responsibilities.
  • Chores

    • Added automated catalog validation to development and pull-request checks.
    • CI now verifies regenerated catalogs are committed and checks translation consistency across supported locales.
    • Removed the automated workflow that filled missing translations in pull requests.