Admin panel in English and Polish, reworded per docs/dev/admin-ux.md

- admin-i18n module: AdminText { en, pl }, component texts under the ipal
  namespace (project translations win), en + pl admin languages when the
  project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
  explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
  messages, Privacy group, Search engines, Maintenance, Spam protection,
  E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
  validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
  env var names out of editor messages; stats numbers/dates in the admin
  language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-27 15:46:25 +01:00
co-authored by Claude Opus 5.5
parent eeac33ed2f
commit 6b46bc0c14
108 changed files with 2806 additions and 981 deletions
+35 -3
View File
@@ -2,6 +2,7 @@ import type { Field, Plugin } from 'payload'
import { seoPlugin } from '@payloadcms/plugin-seo'
import type { AdminText } from '../admin-i18n/define.js'
import type { SeoOption } from './types.js'
type BuildSeoPluginArgs = {
@@ -19,12 +20,43 @@ const titleOverrideField: Field = {
name: 'titleOverride',
type: 'text',
admin: {
description:
'Use this exact text as the browser-tab title — no site name, no separator. Leave empty to compose the title automatically.',
description: {
en: 'Replaces the whole title, site name included; leave empty to build it automatically.',
pl: 'Zastępuje cały tytuł razem z nazwą witryny; zostaw puste, aby utworzyć go automatycznie.',
},
},
label: { en: 'Exact page title', pl: 'Dokładny tytuł strony' },
localized: true,
}
/** Panel wording for plugin-seo's own fields (labels only; names and data unchanged). */
const SEO_FIELD_TEXTS: Record<string, { description?: AdminText; label: AdminText }> = {
description: { label: { en: 'Description', pl: 'Opis' } },
image: {
description: {
en: 'Shown when the page is shared; best under 500 KB.',
pl: 'Widoczny przy udostępnianiu strony; najlepiej poniżej 500 KB.',
},
label: { en: 'Share image', pl: 'Obraz udostępniania' },
},
overview: { label: { en: 'Overview', pl: 'Przegląd' } },
preview: { label: { en: 'Preview', pl: 'Podgląd' } },
title: { label: { en: 'Page title', pl: 'Tytuł strony' } },
}
function withSeoLabels(fields: Field[]): Field[] {
return fields.map((field) => {
const texts = 'name' in field ? SEO_FIELD_TEXTS[field.name] : undefined
if (!texts) {return field}
const admin = (field as { admin?: Record<string, unknown> }).admin
return {
...field,
...(texts.description ? { admin: { ...admin, description: texts.description } } : {}),
label: texts.label,
} as Field
})
}
/**
* Admin hint right under meta.description (MetaDescriptionCheck): empty,
* same as the site-wide description, or same as another document's.
@@ -71,7 +103,7 @@ export function buildSeoPlugin({ seo, uploadsCollection = seo.uploadsCollection
return seoPlugin({
collections: seo.collections,
fields: ({ defaultFields }) => [
...afterDescription(defaultFields, descriptionCheckField(seo)),
...afterDescription(withSeoLabels(defaultFields), descriptionCheckField(seo)),
titleOverrideField,
...(seo.fields ?? []),
],