Skip to content

Fix(admin): make localized action labels word-order safe - #1244

Merged
ascorbic merged 5 commits into
emdash-cms:mainfrom
pitscher:fix/i18n-source-strings
Jun 1, 2026
Merged

ascorbic merged 5 commits into
emdash-cms:mainfrom
pitscher:fix/i18n-source-strings

Conversation

@pitscher

@pitscher pitscher commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR is a follow-up of the PR: #1161 (aligned with @ascorbic)
It fixes issues in the components PluginManager & TaxonomyManager& PortableTextEditor.
It will result in the messages.po files getting updated with:

  1. a new msgid "Insert {0}" entry
  2. other changes to the comments of .po files because already existing msgid's are being reused

Heads Up for maintainers of other languages

I am "just" a German native speaker. However, it seems like the issues this PR fixes impacted other translations (aside German), too. The English suffix approach for permission might interfere with Portuguese, Indonesian, Japanese, Korean and Chinese and it might bypass Polish and Arabic plural rules.
--> You might want to check your translations.

Potential follow-up

While taking care of this fix, I spotted even more hard-coded strings that are missing a translation across the entire admin UI. I propose to create a new PR to cover this if I get a maintainer approval for this plan. Additionally, I'd like to get a pointer for the scope of such a potential PR: should I just attempt to cover all missing strings in one shot (=1 PR, guess this might be a nightmare to review) or shall I do this by component (1 component = 1 PR, might be easier to review)?

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 (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable) - opted against it because (1) there are no other comparable test for such language changes and (2) I did not want to introduce a new test for such a small fix
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • 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: used Codex + GPT 5.5 to challenge my approach

Screenshots / test output

Fixed: List of plugins -> correct plural for "permission" (German singular "Berechtigung", plural "Berechtigungen")

Screenshot 2026-05-31 at 15 48 36

Fixed: Word-order in portable text editor -> add/edit a form -> modal headline (install first party "form" plugin + create a new form + add new form to a post / edit an already added form using the portable text editor)

Screenshot 2026-05-31 at 15 49 38 Screenshot 2026-05-31 at 15 49 48

Pictures of passing tests for PluginManager & TaxonomyManager& PortableTextEditor

Screenshot 2026-05-31 at 16 01 06 Screenshot 2026-05-31 at 16 01 20 Screenshot 2026-05-31 at 16 01 43

@changeset-bot

changeset-bot Bot commented May 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 126479a

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

This PR includes changesets to release 14 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd 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

@pkg-pr-new

pkg-pr-new Bot commented May 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1244

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1244

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1244

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1244

emdash

npm i https://pkg.pr.new/emdash@1244

create-emdash

npm i https://pkg.pr.new/create-emdash@1244

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1244

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1244

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1244

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1244

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1244

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1244

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1244

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1244

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1244

commit: 126479a

@emdashbot emdashbot Bot 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.

This is a focused, correct follow-up that fixes real i18n usability bugs without introducing any regressions.

Approach — right problem, right solution. The PR switches three admin components away from English-centric string concatenation to Lingui-safe interpolation and pluralization:

  • PluginManager: replaces permission${… ? "s" : ""} with plural() so translators can supply the correct plural forms for their language (zero/one/few/many/other).
  • TaxonomyManager & PortableTextEditor: replaces {t\Add`} {label}witht`Add ${label}`` so translators can reorder words (essential for languages where the noun precedes the verb).

These are exactly the patterns documented in AGENTS.md under Admin UI: Localization (Lingui). The English source-string output is identical, so no existing test assertions break. The author kept scope tight, added a proper patch changeset, and refrained from drive-by refactors — all consistent with repo conventions.

Headline verdict: clean and safe to merge.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels May 31, 2026

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! A follow-up to wrap any other hard-coded strings that you find would be great. There's a pseudo-locale that you can use to make them easier to find in the UI too: https://docs.emdashcms.com/contributing/translating/#pseudo-locale

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants