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
+19 -5
View File
@@ -1,9 +1,16 @@
'use client'
import { useRowLabel } from '@payloadcms/ui'
import { useRowLabel, useTranslation } from '@payloadcms/ui'
import type { AdminText } from '../admin-i18n/define.js'
import { ipalT } from '../admin-i18n/t.js'
export type RowLabelProps = {
/** Shown with the row number when every path is empty, e.g. "Button" → "Button 02". */
fallback?: string
/**
* Shown with the row number when every path is empty, e.g. "Button" → "Button 02".
* A string or `{ en, pl }`; default "Item" in the admin language.
*/
fallback?: AdminText | Record<string, string> | string
/** Dot paths inside the row, tried in order — the first non-empty text wins. */
fields?: string[]
}
@@ -29,11 +36,18 @@ const toText = (v: unknown): string => {
* "Fast delivery") instead of "Item 01", so an editor finds the right row
* without expanding every one. Wire it with `rowLabel()`.
*/
export function RowLabel({ fallback = 'Item', fields = ['heading', 'title', 'label', 'link.label', 'name'] }: RowLabelProps) {
export function RowLabel({ fallback, fields = ['heading', 'title', 'label', 'link.label', 'name'] }: RowLabelProps) {
const { data, rowNumber } = useRowLabel<Record<string, unknown>>()
const { i18n, t } = useTranslation()
for (const f of fields) {
const text = toText(at(data, f))
if (text) {return <span>{text.length > 60 ? `${text.slice(0, 57)}…` : text}</span>}
}
return <span>{`${fallback} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`}</span>
const name =
typeof fallback === 'string'
? fallback
: fallback
? ((fallback as Record<string, string>)[i18n.language] ?? fallback.en ?? Object.values(fallback)[0])
: ipalT(t, 'rowLabelItem')
return <span>{`${name} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`}</span>
}
+3 -2
View File
@@ -7,9 +7,10 @@ import type { RowLabelProps } from './RowLabelComponent.js'
* admin: { initCollapsed: true, components: rowLabel(['heading'], 'Feature') }, fields: [...] }
*
* Rows then read "Fast delivery", "24/7 support"… instead of "Feature 01, Feature 02".
* `fallback` may be `{ en, pl }`; without it the row reads "Item 01" in the admin language.
* After adding it to a project: `pnpm payload generate:importmap`.
*/
export function rowLabel(fields: string | string[], fallback = 'Item') {
const clientProps: RowLabelProps = { fallback, fields: Array.isArray(fields) ? fields : [fields] }
export function rowLabel(fields: string | string[], fallback?: RowLabelProps['fallback']) {
const clientProps: RowLabelProps = { fields: Array.isArray(fields) ? fields : [fields], ...(fallback ? { fallback } : {}) }
return { RowLabel: { clientProps, path: '@intecion/ipal-kit/admin#RowLabel' } }
}