Skip to content

fix(admin): translate strings in top-10 admin UI files (i18n leaks) - #936

Closed
ascorbic wants to merge 2 commits into
mainfrom
fix/admin-i18n-leaks
Closed

ascorbic wants to merge 2 commits into
mainfrom
fix/admin-i18n-leaks

Conversation

@ascorbic

@ascorbic ascorbic commented May 7, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Wraps ~250 user-facing English strings in Lingui's `t` macro across the 10 admin files with the most i18n leaks (per a full audit of `packages/admin/src/`). These strings currently bypass translation entirely and render as English in every locale.

This is the second of a series of stacked PRs cleaning up admin UI inconsistencies. #934 (button consistency) merged first.

Files changed:

  • `router.tsx` — toast titles/descriptions for content/comment mutations (publish, unpublish, schedule, delete, restore, duplicate, translate, bulk actions). Plus `LoadingScreen`, `ErrorScreen`, `NotFoundPage`. Uses `plural()` for the comment-bulk-action message.
  • `ContentTypeEditor.tsx` — Settings/Comments/Fields panels, ConfirmDialog props, badges, save buttons. Module-scope `MODERATION_OPTIONS` converted to a `Record<key, MessageDescriptor>` resolved with `t()` at render. Field-count plural via `` + `plural()`. URL pattern hint uses `${"{slug}"}` interpolation to escape the literal `{slug}` token from ICU placeholder syntax.
  • `Widgets.tsx` — page header, drag/drop empty states, dialog labels, palette item titles, ConfirmDialog props, toast feedback.
  • `PortableTextEditor.tsx` — every `title=` / `aria-label=` on the editor toolbar (Bold, Italic, Underline, Strikethrough, Code, headings, lists, alignment, undo/redo, link/image/HR insert, focus mode toggle).
  • `editor/ImageNode.tsx` — `useLingui` added; quick-edit-alt, image settings, delete, alt-text label/placeholder, save/cancel buttons.
  • `editor/PluginBlockNode.tsx` — `useLingui` added; `getEmbedMeta` helper now returns `MessageDescriptor` (using `msg``) so module-scope code can hold non-translated values.
  • `InviteAcceptPage.tsx` — `useLingui` added across three components; error states, form labels, status messages.
  • `users/UserList.tsx` — table headers, search/filter labels, status badges, empty states, load-more button.
  • `routes/bylines.tsx` — `useLingui` added; full page (search, filters, form labels, save/delete buttons, ConfirmDialog props).
  • `routes/users.tsx` — `useLingui` added; disable/demote ConfirmDialog props.

Sub-tasks were dispatched to sub-agents (Haiku-based `simple-tasks` and Kimi for the larger files); main changes verified with full typecheck + test pass.

This is the first half of the i18n cleanup. The remaining ~40 leaks across 23 files (settings panels, marketplace, sandboxed-plugin host, auth flows, lib/api fallback strings) will follow in a separate stacked PR.

Closes #

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • `pnpm typecheck` passes
  • `pnpm lint` passes
  • `pnpm test` passes (admin: 858/858)
  • `pnpm format` has been run
  • I have added/updated tests for my changes (if applicable) — not applicable, all changes are 1:1 string wrapping with no behavior change. Existing test suite covers regressions (one was caught and fixed: ICU placeholder escaping for the literal `{slug}` token).
  • User-visible strings in the admin UI are wrapped for translation. Do not include `messages.po` changes except in translation PRs — a workflow extracts catalogs on merge to `main`.
  • I have added a changeset
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.7 (orchestration) + Claude Haiku 4.5 (`simple-tasks` subagents) + Kimi K2.6 (`kimi-general` subagents) via OpenCode

Screenshots / test output

No visual change in default English locale — strings render identically. Run with `EMDASH_PSEUDO_LOCALE=1` to verify the strings now flow through translation: previously English text leaked through pseudo-localization in these files; after this PR, all listed strings render pseudo-localized.

Stack: `main` → #934 (merged) → this PR → (next: long-tail i18n) → (next: raw HTML to Kumo) → (next: aria-labels) → (next: RTL safety) → (next: semantic tokens) → (last: ESLint enforcement)

ascorbic added 2 commits May 7, 2026 12:47
Use Kumo's Button icon prop and LinkButton (with external for new-tab links)
instead of manual icon spacing and raw anchor styling. Fix invalid Link/Button
nesting in plugin manager. Translate stray English strings in user list empty
state.
Wrap user-facing English strings in Lingui's t macro across the most-used
admin screens: router toasts and error pages, ContentTypeEditor, Widgets,
PortableTextEditor toolbar, ImageNode, PluginBlockNode, InviteAcceptPage,
UserList, routes/users, routes/bylines.

Adds useLingui where missing and converts module-scope label maps to
MessageDescriptor records resolved at render time. Long-tail leaks in
remaining files will follow in a separate PR.
Copilot AI review requested due to automatic review settings May 7, 2026 13:17
@changeset-bot

changeset-bot Bot commented May 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 671930d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs 671930d May 07 2026, 01:12 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-i18n 671930d May 07 2026, 01:11 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-perf-coordinator 671930d May 07 2026, 01:11 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache 671930d May 07 2026, 01:13 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 671930d May 07 2026, 01:13 PM

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Scope check

This PR changes 742 lines across 21 files. Large PRs are harder to review and more likely to be closed without review.

If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs.

See CONTRIBUTING.md for contribution guidelines.

@ascorbic

ascorbic commented May 7, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of a clean branch off main; reopening shortly.

@ascorbic ascorbic closed this May 7, 2026
@ascorbic
ascorbic deleted the fix/admin-i18n-leaks branch May 7, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to eliminate “i18n leaks” in the admin UI by routing user-facing strings through Lingui (via t, Trans, and plural) across several high-traffic screens/components.

Changes:

  • Wraps many previously hard-coded English UI strings (toasts, dialogs, labels, placeholders, aria-labels) with Lingui macros so they can be translated.
  • Introduces some pluralization handling via plural() and richer message composition via <Trans>.
  • Adds/updates Changesets for the admin package.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/admin/src/router.tsx Translates route-level loading/error/not-found UI + many toast strings; adds plural() for bulk comment toast.
packages/admin/src/routes/users.tsx Translates error state + confirm dialog titles/labels and descriptions.
packages/admin/src/routes/bylines.tsx Translates bylines page UI text (search/filter/forms/buttons/dialog).
packages/admin/src/components/Widgets.tsx Translates widgets page strings, dialog labels, empty states, and aria-labels.
packages/admin/src/components/PortableTextEditor.tsx Translates editor modal/tooltips/aria-label/title strings.
packages/admin/src/components/editor/ImageNode.tsx Translates image-node tooltips/aria-labels/alt-text UI strings.
packages/admin/src/components/editor/PluginBlockNode.tsx Moves embed placeholder metadata to MessageDescriptor and translates node UI tooltips/labels.
packages/admin/src/components/InviteAcceptPage.tsx Translates invite-accept flow headings/labels/status/error UI strings.
packages/admin/src/components/users/UserList.tsx Translates user list headers/filters/empty states/status labels.
packages/admin/src/components/ContentTypeEditor.tsx Translates content type editor panels, validation hints, moderation options, and pluralized field counts.
packages/admin/src/components/ContentList.tsx Uses LinkButton for external view action; keeps aria-label translated.
packages/admin/src/components/ContentEditor.tsx Uses LinkButton for Live View; minor button API adjustments.
packages/admin/src/components/PluginManager.tsx Button/icon usage adjustments; marketplace link rendered as a styled Link.
packages/admin/src/components/MenuList.tsx Marks decorative icon as aria-hidden and adjusts class ordering.
packages/admin/src/components/ThemeMarketplaceDetail.tsx Uses LinkButton for demo link and icon prop for preview button.
packages/admin/src/components/ThemeMarketplaceBrowse.tsx Uses icon prop for retry button.
packages/admin/src/components/MarketplaceBrowse.tsx Uses icon prop for retry button.
packages/admin/src/components/MarketplacePluginDetail.tsx Uses icon prop for install button.
packages/admin/src/components/WordPressImport.tsx Uses semantic brand color class; marks external-link icon aria-hidden.
.changeset/tall-flies-vanish.md Adds a patch changeset describing the i18n leak fixes.
.changeset/legal-doodles-move.md Adds a patch changeset describing button/link standardization work (appears to match #934).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +5
---
"@emdash-cms/admin": patch
---

Fixes button and link inconsistencies across the admin UI. Standardises on Kumo's `Button` `icon` prop and `LinkButton` (with `external` for new-tab links) instead of manual icon spacing and raw anchor styling, removes a `<Link><Button>` invalid HTML nesting in the plugin manager, and translates two stray English strings in the user list empty state.
title: "Translation created",
description: `Created ${result.locale?.toUpperCase() ?? "new"} translation`,
title: t`Translation created`,
description: t`Created ${result.locale?.toUpperCase() ?? t`new`} translation`,
Comment on lines 718 to 723
<button
{...attributes}
{...listeners}
className="cursor-grab active:cursor-grabbing"
aria-label={`Drag to reorder ${widget.title || "widget"}`}
aria-label={t`Drag to reorder ${widget.title ?? t`widget`}`}
>
Comment on lines 733 to 738
<Button
variant="ghost"
size="sm"
onClick={() => deleteMutation.mutate()}
aria-label={`Delete ${widget.title || "widget"}`}
aria-label={t`Delete ${widget.title ?? t`widget`}`}
>
Comment on lines 158 to 163
React.useEffect(() => {
if (!urlToken) {
setError("No invite token provided");
setError(t`No invite token provided`);
setStep("error");
setIsLoading(false);
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants