Skip to content

Nothing checks the message catalogs, or catches new hard-coded text #623

Closed

Description

@richshaw

Needs your OK: this adds checks on the translation catalogs and lint rules against hard-coded text. Nothing anyone sees changes. Swap pipeline:proposed for pipeline:ready to have it built.

What happens

Once text lives in src/messages/*.json (#620), nothing stops a translation from missing keys, breaking ICU syntax or dropping a {name}. Nothing stops new English being typed straight into a component either.

Fix, in outline

  • A catalog check that pnpm test runs (a unit test over src/messages/, so CI covers it with no workflow change). It checks that:
    • every catalog's completeness is known per namespace against en.json, and each language in SHIPPED is complete for its audience (participant: participant, email, common; organizer: organizer, auth, common; site: site, common);
    • every message compiles with icu-minify, which uses the same ICU parser as use-intl's full formatter;
    • placeholders and tags match the English source;
    • no key is unused.
  • Keys are literal, so the unused-key check can see them. Map enum values to keys through a typed table (const STATUS_KEY = { open: 'status.open', … } as const), never t(`status.${s}`).
  • Lint for hard-coded text:

Watch for

  • noAttributeStrings doesn't work here. It flags every className and href, and eslint-plugin-react 7.37.5 (what the lockfile resolves) has no per-attribute option.
  • Pin icu-minify as a devDependency at the exact version next-intl resolves, so the check runs the parser production runs.

Order

After #620, because the catalogs, SHIPPED and the local ESLint plugin come from it.

Done when

  • The check fails on a missing key, broken ICU, a dropped placeholder and an unused key (tests with fixture catalogs).
  • The lint rules fail on a fixture with JSX text and one with aria-label="…".
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test pass.

Planned with the owner in https://claude.ai/code/session_01EFKmj716ZY3b3SwR8TV8Y2 and checked against the code on main at 35288fa. The full plan is private to the owner's account: https://claude.ai/artifact/VgQH6U2s2EVx3LX991fJi8 (a Claude session on that account can open it with the Artifact tool's read action). This is step 0.4 there.

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

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions