Repository navigation
Fix(admin): make localized action labels word-order safe - #1244
Conversation
…nder btn and modal texts
… render modal texts
🦋 Changeset detectedLatest commit: 126479a The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
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" : ""}withplural()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.
ascorbic
left a comment
There was a problem hiding this comment.
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
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.pofiles getting updated with:msgid "Insert {0}"entry.pofiles because already existingmsgid's are being reusedHeads 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
permissionmight 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
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
Fixed: List of plugins -> correct plural for "permission" (German singular "Berechtigung", plural "Berechtigungen")
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)
Pictures of passing tests for
PluginManager&TaxonomyManager&PortableTextEditor