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
@@ -7,6 +7,7 @@ import { useEffect, useState } from 'react'
import type { CookieScanLabels } from './labels.js'
import type { CookieScanSummary } from './types.js'
import { formatDateTime } from '../../admin-i18n/t.js'
import { COOKIE_SCAN_LABELS } from './labels.js'
type CrawlState = {
@@ -48,7 +49,7 @@ export function CookieScanButton({ crawl = false, labels = COOKIE_SCAN_LABELS }:
const [crawlState, setCrawlState] = useState<CrawlState | null>(null)
const [crawlStarting, setCrawlStarting] = useState(false)
const crawlEndpoint = endpoint.replace(/cookie-scan$/, 'cookie-crawl')
const when = (iso: null | string) => (iso ? new Date(iso).toLocaleString(i18n.language) : '')
const when = (iso: null | string) => (iso ? formatDateTime(iso, i18n.language) : '')
useEffect(() => {
if (!crawl) {return}
@@ -155,7 +156,7 @@ export function CookieScanButton({ crawl = false, labels = COOKIE_SCAN_LABELS }:
{t.crawlButton}
</Button>
<span role="status">
{crawlState && !crawlState.configured ? `${t.crawlNotConfigured} (${crawlState.missing.join(', ')})` : null}
{crawlState && !crawlState.configured ? t.crawlNotConfigured : null}
{crawlState?.configured && crawlState.status === 'running' ? fill(t.crawlRunning, { startedAt: when(crawlState.startedAt) }) : null}
{crawlState?.configured && crawlState.status === 'done'
? fill(t.crawlDone, { finishedAt: when(crawlState.finishedAt), newUnknown: crawlState.summary?.newUnknown ?? 0, pages: crawlState.summary?.pages ?? 0, violations: crawlState.summary?.violations ?? 0 })
+1 -1
View File
@@ -95,7 +95,7 @@ export function buildCookieReviewCollection(options: CookieScannerOptions = {}):
},
defaultColumns: ['name', 'vendor', 'category', 'status', 'source', 'listed', ...(crawl ? ['violation'] : [])],
description: L('collectionDescription'),
group: 'Settings',
group: { en: 'Privacy', pl: 'Prywatność' },
listSearchableFields: ['name', 'vendor'],
useAsTitle: 'name',
},
@@ -122,7 +122,7 @@ export function buildCookieCrawlEndpoints({
} catch (err) {
const message = err instanceof Error ? err.message : String(err)
req.payload.logger.error(`[ipal] cookie crawl: could not start — ${message}`)
await write(req, { error: `Could not reach the scanner service: ${message}`, finishedAt: new Date().toISOString(), jobId: null, status: 'failed' })
await write(req, { error: 'The checking service could not be reached. Please try again later.', finishedAt: new Date().toISOString(), jobId: null, status: 'failed' })
return Response.json({ error: 'service_unreachable', ok: false }, { status: 502 })
}
return Response.json({ ok: true, status: 'running' }, { status: 202 })
@@ -155,7 +155,7 @@ export function buildCookieCrawlEndpoints({
} catch (err) {
const message = err instanceof Error ? err.message : String(err)
req.payload.logger.error(`[ipal] cookie crawl: saving the result failed — ${message}`)
await write(req, { error: `Saving the result failed: ${message}`, finishedAt: new Date().toISOString(), jobId: null, status: 'failed' })
await write(req, { error: 'The result could not be saved. Please run the check again.', finishedAt: new Date().toISOString(), jobId: null, status: 'failed' })
return Response.json({ ok: false }, { status: 500 })
}
},
+7 -7
View File
@@ -3,7 +3,7 @@ import type { GlobalConfig } from 'payload'
import type { CookieScanLabels } from '../labels.js'
import { userMeetsRole } from '../../../access/predicates.js'
import { labelRecord } from '../labels.js'
import { labelFor, labelRecord } from '../labels.js'
import { COOKIE_CRAWL_SLUG } from './config.js'
/**
@@ -20,16 +20,16 @@ export function buildCookieCrawlGlobal(labels: Record<string, CookieScanLabels>)
read: ({ req }) => userMeetsRole(req, 'editor'),
update: ({ req }) => userMeetsRole(req, 'admin'),
},
admin: { description: L('crawlGlobalDescription'), group: 'Settings' },
admin: { description: L('crawlGlobalDescription'), group: { en: 'Privacy', pl: 'Prywatność' } },
fields: [
{
name: 'notifyEmails',
type: 'text',
admin: { description: L('notifyEmailsDescription') },
label: L('notifyEmails'),
validate: (value: null | string | undefined) => {
validate: (value: null | string | undefined, { req }: { req: { i18n?: { language?: string } } }) => {
const list = (value ?? '').split(',').map((v) => v.trim()).filter(Boolean)
return list.every((v) => /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(v)) || 'Comma-separated e-mail addresses.'
return list.every((v) => /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(v)) || labelFor(labels, req?.i18n?.language, 'notifyEmailsInvalid')
},
},
{
@@ -56,9 +56,9 @@ export function buildCookieCrawlGlobal(labels: Record<string, CookieScanLabels>)
fields: [
{ name: 'pages', type: 'number', admin: ro, label: L('crawlPages') },
{ name: 'violations', type: 'number', admin: ro, label: L('crawlViolations') },
{ name: 'newUnknown', type: 'number', admin: ro, label: L('unknown') },
{ name: 'created', type: 'number', admin: ro },
{ name: 'updated', type: 'number', admin: ro },
{ name: 'newUnknown', type: 'number', admin: ro, label: L('crawlNewUnknown') },
{ name: 'created', type: 'number', admin: ro, label: L('crawlCreated') },
{ name: 'updated', type: 'number', admin: ro, label: L('crawlUpdated') },
],
label: false,
},
+1 -1
View File
@@ -132,7 +132,7 @@ export async function finishCrawl({
...common,
data: {
// Not a failure, but the "after accept" half saw no consent — say so where the editor looks.
error: result.accepted ? null : 'The "Accept all" button was not found (acceptSelector), so the second run had no consent.',
error: result.accepted ? null : 'The "Accept all" button was not found, so the site could not be checked after consent.',
finishedAt: now,
jobId: null,
pages: result.pages,
+87 -77
View File
@@ -1,5 +1,5 @@
/**
* Admin labels of the cookie scanner, per admin language. Payload picks the
* Admin labels of the cookie scanner (review list, scan box, site check), per admin language. Payload picks the
* user's admin language from a `{ en, pl }` record; a language missing here falls
* back to English. Projects add or change languages with `cookieScanner.labels`.
*/
@@ -16,6 +16,7 @@ export type CookieScanLabels = {
collectionDescription: string
cookie: string
crawlButton: string
crawlCreated: string
crawlDone: string
crawlError: string
crawlFailed: string
@@ -23,6 +24,7 @@ export type CookieScanLabels = {
crawlGlobalDescription: string
crawlIdle: string
crawlIntro: string
crawlNewUnknown: string
crawlNotConfigured: string
crawlPages: string
crawlRequests: string
@@ -31,6 +33,7 @@ export type CookieScanLabels = {
crawlStateFailed: string
crawlStateRunning: string
crawlStatus: string
crawlUpdated: string
crawlViolations: string
database: string
domain: string
@@ -54,6 +57,7 @@ export type CookieScanLabels = {
necessary: string
notifyEmails: string
notifyEmailsDescription: string
notifyEmailsInvalid: string
plural: string
project: string
purpose: string
@@ -88,161 +92,167 @@ export const COOKIE_SCAN_LABELS: Record<'en' | 'pl', CookieScanLabels> = {
en: {
name: 'Name',
accepted: 'Accepted',
alertBody: 'Non-necessary cookies or trackers load before consent, or the site sets cookies nobody has described yet. Check the review list.',
alertFailed: 'Cookie crawl failed: {error}',
alertLink: 'Open Cookie review →',
alertTitle: 'Cookie crawl: {violations} violations, {newUnknown} new unknown cookies.',
alertBody: 'Cookies that are not necessary load before consent, or some cookies have no description yet. Check the cookie review.',
alertFailed: 'The cookie check failed: {error}',
alertLink: 'Open cookie review',
alertTitle: 'Cookie check: violations: {violations}, new unknown cookies: {newUnknown}.',
analytics: 'Analytics',
beforeConsentOn: 'before consent on {pages}',
category: 'Category',
categoryRequired: 'Pick a category before accepting.',
collectionDescription:
'Cookies found by "Scan cookies". Check each draft, then set it to Accepted (it is added to Cookie Settings → Cookies) or Rejected. A scan never deletes entries and never changes text you edited.',
categoryRequired: 'Choose a category before accepting.',
collectionDescription: 'Accept a cookie to add it to the cookie list; a new scan never overwrites your edits.',
cookie: 'Cookie',
crawlButton: 'Crawl site',
crawlDone: 'Last crawl {finishedAt}: {pages} pages, {violations} violations, {newUnknown} new unknown.',
crawlButton: 'Check site',
crawlCreated: 'New drafts',
crawlDone: 'Last check {finishedAt}: pages: {pages}, violations: {violations}, new unknown: {newUnknown}.',
crawlError: 'Error',
crawlFailed: 'The last crawl failed: {error}',
crawlGlobal: 'Cookie crawl',
crawlGlobalDescription: 'The latest browser crawl only. Start one from Cookie review → Crawl site.',
crawlIdle: 'Never run',
crawlIntro: 'Opens the site in a browser twice — without consent and after "Accept all" — and records cookies, storage and third-party requests. New findings become drafts.',
crawlNotConfigured: 'The crawl needs IPAL_COOKIE_SCAN_URL and IPAL_COOKIE_SCAN_TOKEN on the server.',
crawlPages: 'Pages crawled',
crawlFailed: 'The last check failed: {error}',
crawlGlobal: 'Cookie check',
crawlGlobalDescription: 'Result of the latest site check, started in Cookie review.',
crawlIdle: 'Not run yet',
crawlIntro: 'Opens the site in a browser before and after "Accept all", and records cookies, storage and requests to other services.',
crawlNewUnknown: 'New unknown cookies',
crawlNotConfigured: 'The site check is not set up on the server. Ask your administrator.',
crawlPages: 'Pages checked',
crawlRequests: 'Third-party requests',
crawlRunning: 'Crawling… started {startedAt}.',
crawlRunning: 'Checking… started {startedAt}.',
crawlStateDone: 'Done',
crawlStateFailed: 'Failed',
crawlStateRunning: 'Running',
crawlStatus: 'Status',
crawlUpdated: 'Updated drafts',
crawlViolations: 'Violations',
database: 'Open Cookie Database',
domain: 'Domain',
draft: 'Draft',
emailIntro: 'The latest cookie crawl of {site} found:',
emailSubject: 'Cookie crawl of {site}: {violations} violations, {newUnknown} new unknown',
emailIntro: 'The latest cookie check of {site} found:',
emailSubject: 'Cookie check of {site}: violations: {violations}, new unknown cookies: {newUnknown}',
finishedAt: 'Finished',
functional: 'Functional',
integration: 'Plugin integration',
integration: 'Built-in integration',
integrationsFound: 'Integrations in use',
integrationsNone: 'No integration with cookies is switched on.',
lastScannedAt: 'Last seen by a scan',
listed: 'In the cookie list',
listedDescription: 'Already in Cookie Settings → Cookies.',
integrationsNone: 'No integration that uses cookies is on.',
lastScannedAt: 'Last found',
listed: 'In cookie list',
listedDescription: 'Already in the cookie list of the cookie banner.',
localStorage: 'Local storage',
manual: 'Added by hand',
marketing: 'Marketing',
namesHint: 'Optional: cookie names seen in the browser (DevTools → Application → Cookies), one per line. They are looked up in the plugin and the Open Cookie Database.',
namesHint: 'Optional. Other cookie names, one per line. They are looked up in the Open Cookie Database.',
namesLabel: 'More cookie names',
necessary: 'Necessary',
notifyEmails: 'E-mail warnings to',
notifyEmailsDescription: 'Comma-separated addresses. After a crawl with violations or new unknown cookies, a warning is sent through the site\'s mail setup. Empty = no e-mail.',
notifyEmails: 'Warning e-mails to',
notifyEmailsDescription: 'Comma-separated addresses that get a warning when a check finds problems; leave empty for none.',
notifyEmailsInvalid: 'Enter e-mail addresses separated by commas, e.g. [email protected], [email protected].',
plural: 'Cookie review',
project: 'Project declaration',
project: 'Site configuration',
purpose: 'Purpose',
rejected: 'Rejected',
retention: 'Retention',
retention: 'Duration',
scanButton: 'Scan cookies',
scanError: 'The scan failed.',
scanIntro: 'Lists the cookies of the integrations switched on in this project as drafts to review.',
scanError: 'The scan failed. Please try again.',
scanIntro: 'Adds the cookies of the integrations in use as drafts to review.',
scanning: 'Scanning…',
scanResult: '{created} new, {updated} updated, {unchanged} unchanged, {unknown} unknown.',
scanResult: 'New: {created}, updated: {updated}, unchanged: {unchanged}, unknown: {unknown}.',
seenBeforeConsent: 'Seen before consent',
sessionStorage: 'Session storage',
setBeforeConsent: 'Set before consent',
setBeforeConsentDescription: 'May be set before the visitor decides. Only necessary cookies should be.',
singular: 'Cookie review entry',
setBeforeConsentDescription: 'Set before the visitor decides, which only necessary cookies may be.',
singular: 'Cookie',
source: 'Found by',
sourceDetail: 'Source',
startedAt: 'Started',
startedBy: 'Started by',
status: 'Status',
statusDescription: 'Accepted → added to Cookie Settings → Cookies. Rejecting never removes a row from that list.',
statusDescription: 'Accepted cookies are added to the cookie list; rejecting never removes them from it.',
storage: 'Stored in',
unknown: 'Unknown — fill in',
unknown: 'Unknown',
vendor: 'Provider',
violation: 'Violation',
violationDescription: 'Seen before consent in the latest crawl and not necessary.',
violationDescription: 'Not necessary, yet seen before consent in the latest site check.',
violationDetail: 'Violation details',
},
pl: {
name: 'Nazwa',
accepted: 'Zaakceptowany',
alertBody: 'Cookies lub skrypty śledzące, które nie są niezbędne, ładują się przed zgodą — albo strona ustawia cookies, których nikt jeszcze nie opisał. Sprawdź listę przeglądu.',
alertFailed: 'Skan cookies się nie powiódł: {error}',
alertLink: 'Otwórz Przegląd cookies →',
alertTitle: 'Skan cookies: naruszeń {violations}, nowych nieznanych cookies {newUnknown}.',
alertBody: 'Cookies, które nie są niezbędne, ładują się przed zgodą albo część cookies nie ma jeszcze opisu. Sprawdź przegląd cookies.',
alertFailed: 'Kontrola cookies nie powiodła się: {error}',
alertLink: 'Otwórz przegląd cookies',
alertTitle: 'Kontrola cookies: naruszenia: {violations}, nowe nieznane cookies: {newUnknown}.',
analytics: 'Analityczne',
beforeConsentOn: 'przed zgodą na {pages}',
category: 'Kategoria',
categoryRequired: 'Wybierz kategorię przed akceptacją.',
collectionDescription:
'Pliki cookie znalezione przez „Skanuj cookies”. Sprawdź każdy szkic i ustaw Zaakceptowany (trafi do Ustawień cookies → Cookies) albo Odrzucony. Skan nigdy nie usuwa wpisów ani nie zmienia poprawionych przez Ciebie tekstów.',
collectionDescription: 'Zaakceptuj plik cookie, aby dodać go do listy cookies; kolejny skan nie nadpisze zmian.',
cookie: 'Cookie',
crawlButton: 'Przeskanuj stronę',
crawlDone: 'Ostatni skan {finishedAt}: stron {pages}, naruszeń {violations}, nowych nieznanych {newUnknown}.',
crawlButton: 'Sprawdź witrynę',
crawlCreated: 'Nowe szkice',
crawlDone: 'Ostatnia kontrola {finishedAt}: strony: {pages}, naruszenia: {violations}, nowe nieznane: {newUnknown}.',
crawlError: 'Błąd',
crawlFailed: 'Ostatni skan się nie powiódł: {error}',
crawlGlobal: 'Skan cookies przeglądarką',
crawlGlobalDescription: 'Tylko ostatni skan przeglądarką. Uruchom go w Przeglądzie cookies → Przeskanuj stronę.',
crawlIdle: 'Nie uruchamiano',
crawlIntro: 'Otwiera stronę w przeglądarce dwa razy — bez zgody i po „Akceptuj wszystkie” — i zapisuje cookies, pamięć przeglądarki i zapytania do zewnętrznych serwisów. Nowe znaleziska trafiają jako szkice.',
crawlNotConfigured: 'Skan przeglądarką wymaga IPAL_COOKIE_SCAN_URL i IPAL_COOKIE_SCAN_TOKEN na serwerze.',
crawlPages: 'Przeskanowane strony',
crawlRequests: 'Zapytania do zewnętrznych serwisów',
crawlRunning: 'Skanowanie… rozpoczęte {startedAt}.',
crawlFailed: 'Ostatnia kontrola nie powiodła się: {error}',
crawlGlobal: 'Kontrola cookies',
crawlGlobalDescription: 'Wynik ostatniej kontroli witryny uruchomionej w przeglądzie cookies.',
crawlIdle: 'Jeszcze nie uruchomiono',
crawlIntro: 'Otwiera witrynę w przeglądarce przed i po „Akceptuj wszystkie” i zapisuje cookies, pamięć przeglądarki oraz zapytania do innych serwisów.',
crawlNewUnknown: 'Nowe nieznane cookies',
crawlNotConfigured: 'Kontrola witryny nie jest skonfigurowana na serwerze. Skontaktuj się z administratorem.',
crawlPages: 'Sprawdzone strony',
crawlRequests: 'Zapytania zewnętrzne',
crawlRunning: 'Sprawdzanie… rozpoczęte {startedAt}.',
crawlStateDone: 'Gotowe',
crawlStateFailed: 'Błąd',
crawlStateRunning: 'W toku',
crawlStatus: 'Status',
crawlUpdated: 'Zaktualizowane szkice',
crawlViolations: 'Naruszenia',
database: 'Open Cookie Database',
domain: 'Domena',
draft: 'Szkic',
emailIntro: 'Ostatni skan cookies strony {site} znalazł:',
emailSubject: 'Skan cookies {site}: naruszeń {violations}, nowych nieznanych {newUnknown}',
finishedAt: 'Zakończony',
emailIntro: 'Ostatnia kontrola cookies witryny {site} wykazała:',
emailSubject: 'Kontrola cookies {site}: naruszenia: {violations}, nowe nieznane cookies: {newUnknown}',
finishedAt: 'Zakończono',
functional: 'Funkcjonalne',
integration: 'Integracja wtyczki',
integration: 'Wbudowana integracja',
integrationsFound: 'Używane integracje',
integrationsNone: 'Żadna integracja z plikami cookie nie jest włączona.',
lastScannedAt: 'Ostatnio widziany w skanie',
integrationsNone: 'Żadna integracja używająca cookies nie jest włączona.',
lastScannedAt: 'Ostatnio znaleziony',
listed: 'Na liście cookies',
listedDescription: 'Już jest w Ustawieniach cookies → Cookies.',
listedDescription: 'Już jest na liście cookies banera.',
localStorage: 'Local storage',
manual: 'Dodany ręcznie',
marketing: 'Marketingowe',
namesHint: 'Opcjonalnie: nazwy cookies widoczne w przeglądarce (DevTools → Application → Cookies), po jednej w wierszu. Zostaną wyszukane we wtyczce i w Open Cookie Database.',
namesHint: 'Opcjonalnie. Inne nazwy cookies, po jednej w wierszu. Zostaną wyszukane w Open Cookie Database.',
namesLabel: 'Dodatkowe nazwy cookies',
necessary: 'Niezbędne',
notifyEmails: 'Ostrzeżenia e-mail do',
notifyEmailsDescription: 'Adresy po przecinku. Po skanie z naruszeniami lub nowymi nieznanymi cookies wysyłane jest ostrzeżenie przez konfigurację poczty strony. Puste = bez e-maili.',
notifyEmailsDescription: 'Adresy po przecinku, na które trafi ostrzeżenie, gdy kontrola wykryje problemy; zostaw puste, aby nie wysyłać.',
notifyEmailsInvalid: 'Wpisz adresy e-mail oddzielone przecinkami, np. [email protected], [email protected].',
plural: 'Przegląd cookies',
project: 'Deklaracja projektu',
project: 'Konfiguracja witryny',
purpose: 'Cel',
rejected: 'Odrzucony',
retention: 'Czas przechowywania',
retention: 'Okres',
scanButton: 'Skanuj cookies',
scanError: 'Skan się nie powiódł.',
scanIntro: 'Dodaje cookies integracji włączonych w tym projekcie jako szkice do przejrzenia.',
scanError: 'Skanowanie nie powiodło się. Spróbuj ponownie.',
scanIntro: 'Dodaje cookies używanych integracji jako szkice do przejrzenia.',
scanning: 'Skanowanie…',
scanResult: 'Nowe: {created}, zaktualizowane: {updated}, bez zmian: {unchanged}, nieznane: {unknown}.',
seenBeforeConsent: 'Widoczny przed zgodą',
sessionStorage: 'Session storage',
setBeforeConsent: 'Ustawiany przed zgodą',
setBeforeConsentDescription: 'Może powstać, zanim odwiedzający zdecyduje. Tylko niezbędne cookies powinny.',
singular: 'Wpis przeglądu cookies',
setBeforeConsentDescription: 'Ustawiany, zanim odwiedzający zdecyduje, co wolno tylko niezbędnym cookies.',
singular: 'Plik cookie',
source: 'Źródło',
sourceDetail: 'Skąd',
startedAt: 'Rozpoczęty',
startedBy: 'Uruchomił',
sourceDetail: 'Szczegóły źródła',
startedAt: 'Rozpoczęto',
startedBy: 'Uruchomił(a)',
status: 'Status',
statusDescription: 'Zaakceptowany → trafia do Ustawień cookies → Cookies. Odrzucenie nigdy nie usuwa wiersza z tej listy.',
storage: 'Przechowywany w',
unknown: 'Nieznany — uzupełnij',
statusDescription: 'Zaakceptowane cookies trafiają na listę cookies; odrzucenie nigdy ich z niej nie usuwa.',
storage: 'Miejsce zapisu',
unknown: 'Nieznane',
vendor: 'Dostawca',
violation: 'Naruszenie',
violationDescription: 'Widoczny przed zgodą w ostatnim skanie i nie jest niezbędny.',
violationDescription: 'Nie jest niezbędny, a pojawił się przed zgodą w ostatniej kontroli witryny.',
violationDetail: 'Szczegóły naruszenia',
},
}