Skip to content

DX: surface pending translations in the sidebar during dev - #222

Merged
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
greatest0fallt1me:feat/113-pending-translations-sidebar-dev
Aug 28, 2026
Merged

DX: surface pending translations in the sidebar during dev#222
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
greatest0fallt1me:feat/113-pending-translations-sidebar-dev

Conversation

@greatest0fallt1me

@greatest0fallt1me greatest0fallt1me commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Discovering an untranslated key meant reading `lib/i18n/messages.ts` directly, or catching a dev-only `console.warn` at the exact moment `t()` happened to hit it at runtime -- no proactive way to see what's outstanding.

Change

  • `lib/i18n/pendingTranslations.ts`: `getPendingTranslations(locale)` returns the keys present in `en` (the source of truth) but missing from that locale's own partial dictionary; `getAllPendingTranslations()` does this for every non-default locale.
  • `components/Sidebar.tsx`: renders a small `role="status"` notice with the pending count per locale (e.g. `es: 4 pending`), right where a contributor is already looking. Gated on `NODE_ENV !== "production"` and hidden along with the rest of the nav content when the sidebar is collapsed.

Tests

  • `lib/i18n/pendingTranslations.test.ts`: no pending keys for the default locale, correct pending set for `es`, every pending key is real, `getAllPendingTranslations` covers exactly the non-default locales and matches the single-locale function.
  • `components/Sidebar.test.tsx`: notice renders with the expected text outside production, is hidden in production, and is hidden when the sidebar is collapsed.

`npx vitest run lib/i18n/pendingTranslations.test.ts components/Sidebar.test.tsx`: 12 passed. `npx tsc --noEmit` / `npx eslint` on changed files: clean.

Related to #113

Discovering an untranslated key meant reading lib/i18n/messages.ts
directly or catching a console warning at the exact moment t() hit a
missing key. Add lib/i18n/pendingTranslations.ts
(getPendingTranslations/getAllPendingTranslations: keys present in en
but missing from a locale's partial dictionary) and render a small
dev-only notice in Sidebar with the pending count per locale --
never rendered in production.
@Baskarayelu
Baskarayelu merged commit 7784ce5 into QuickLendX:main Aug 28, 2026
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.

2 participants