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:
co-authored by
Claude Opus 5.5
parent
eeac33ed2f
commit
6b46bc0c14
@@ -1,12 +1,33 @@
|
||||
import type { Field } from 'payload'
|
||||
|
||||
import { LIGHTBOX_FALLBACK } from '../../modules/lightbox/texts.js'
|
||||
import { LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL } from '../../modules/lightbox/texts.js'
|
||||
import { NOTIFICATION_FALLBACK, NOTIFICATION_FALLBACK_PL } from '../../modules/notifications/defaults.js'
|
||||
|
||||
const EN = NOTIFICATION_FALLBACK.form
|
||||
const PL = NOTIFICATION_FALLBACK_PL.form
|
||||
|
||||
/** A form text: the default in both languages is the placeholder. */
|
||||
const formText = (
|
||||
name: keyof typeof EN,
|
||||
label: { en: string; pl: string },
|
||||
extra: { description?: { en: string; pl: string }; width?: string } = {},
|
||||
): Field => ({
|
||||
name,
|
||||
type: 'text',
|
||||
admin: {
|
||||
placeholder: { en: EN[name], pl: PL[name] },
|
||||
...(extra.description ? { description: extra.description } : {}),
|
||||
...(extra.width ? { width: extra.width } : {}),
|
||||
},
|
||||
label,
|
||||
localized: true,
|
||||
})
|
||||
|
||||
/**
|
||||
* Fields for the Notifications global — localized user-facing texts for action
|
||||
* results (form submission outcomes, and future contexts). Every text is
|
||||
* localized: true so each language has its own value. Empty fields fall back to
|
||||
* built-in English defaults (see modules/notifications/defaults).
|
||||
* the built-in defaults of the page's language (see modules/notifications/defaults).
|
||||
*
|
||||
* Grouped per context. `form` holds the outcomes of submitForm; more groups
|
||||
* (e.g. `newsletter`, `system`) can be added the same way without touching
|
||||
@@ -18,91 +39,52 @@ export const notificationsFields: Field[] = [
|
||||
name: 'form',
|
||||
type: 'group',
|
||||
admin: {
|
||||
description:
|
||||
'Messages shown after a form is submitted. Leave a field empty to use the built-in default.',
|
||||
description: {
|
||||
en: 'Shown to visitors after they send a form; leave a field empty to use the default.',
|
||||
pl: 'Widoczne dla odwiedzających po wysłaniu formularza; zostaw pole puste, aby użyć domyślnej wartości.',
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'success',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'Thank you — your message has been sent.' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'error',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'Something went wrong. Please try again later.' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'rateLimited',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'Too many attempts. Please wait a moment and try again.' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'turnstile',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'Captcha verification failed. Please try again.' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'validation',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description:
|
||||
'Shown on a validation error. Use {field} to insert the offending field name.',
|
||||
placeholder: 'Please check the {field} field and try again.',
|
||||
formText('success', { en: 'Sent', pl: 'Wysłano' }),
|
||||
formText('error', { en: 'Error', pl: 'Błąd' }),
|
||||
formText('validation', { en: 'Field error', pl: 'Błąd pola' }, {
|
||||
description: { en: 'Use {field} for the field label.', pl: 'Użyj {field}, aby wstawić etykietę pola.' },
|
||||
}),
|
||||
formText('consent', { en: 'Consent missing', pl: 'Brak zgody' }, {
|
||||
description: {
|
||||
en: 'Shown when the privacy policy box is not ticked.',
|
||||
pl: 'Widoczny, gdy pole zgody na politykę prywatności nie jest zaznaczone.',
|
||||
},
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'consent',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Shown when the GDPR consent checkbox is left unchecked.',
|
||||
placeholder: 'Please accept the privacy policy to continue.',
|
||||
},
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'notFound',
|
||||
type: 'text',
|
||||
admin: { placeholder: 'This form is no longer available.' },
|
||||
localized: true,
|
||||
},
|
||||
}),
|
||||
formText('turnstile', { en: 'Spam check failed', pl: 'Błąd weryfikacji' }),
|
||||
formText('rateLimited', { en: 'Too many attempts', pl: 'Zbyt wiele prób' }),
|
||||
formText('notFound', { en: 'Form unavailable', pl: 'Formularz niedostępny' }),
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
{
|
||||
name: 'next',
|
||||
type: 'text',
|
||||
admin: { description: 'Step-by-step forms: button to the next step.', placeholder: 'Next', width: '33%' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'back',
|
||||
type: 'text',
|
||||
admin: { description: 'Step-by-step forms: button to the previous step.', placeholder: 'Back', width: '33%' },
|
||||
localized: true,
|
||||
},
|
||||
{
|
||||
name: 'stepOf',
|
||||
type: 'text',
|
||||
admin: { description: 'Progress — {current} and {total} are replaced.', placeholder: 'Step {current} of {total}', width: '34%' },
|
||||
localized: true,
|
||||
},
|
||||
formText('next', { en: 'Next button', pl: 'Przycisk „Dalej”' }, { width: '33%' }),
|
||||
formText('back', { en: 'Back button', pl: 'Przycisk „Wstecz”' }, { width: '33%' }),
|
||||
formText('stepOf', { en: 'Step counter', pl: 'Licznik kroków' }, {
|
||||
description: { en: 'Use {current} and {total} for the numbers.', pl: 'Użyj {current} i {total}, aby wstawić liczby.' },
|
||||
width: '34%',
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
label: 'Form messages',
|
||||
label: { en: 'Forms', pl: 'Formularze' },
|
||||
},
|
||||
]
|
||||
|
||||
const lightboxText = (name: keyof typeof LIGHTBOX_FALLBACK, width: string, description?: string): Field => ({
|
||||
const lightboxText = (
|
||||
name: keyof typeof LIGHTBOX_FALLBACK,
|
||||
label: { en: string; pl: string },
|
||||
width: string,
|
||||
description?: { en: string; pl: string },
|
||||
): Field => ({
|
||||
name,
|
||||
type: 'text',
|
||||
admin: { placeholder: LIGHTBOX_FALLBACK[name], width, ...(description ? { description } : {}) },
|
||||
admin: { placeholder: { en: LIGHTBOX_FALLBACK[name], pl: LIGHTBOX_FALLBACK_PL[name] }, width, ...(description ? { description } : {}) },
|
||||
label,
|
||||
localized: true,
|
||||
})
|
||||
|
||||
@@ -115,25 +97,34 @@ export const lightboxNotificationFields: Field = {
|
||||
name: 'lightbox',
|
||||
type: 'group',
|
||||
admin: {
|
||||
description: 'Labels of the enlarged-image viewer, read by screen readers. Leave a field empty to use the built-in default.',
|
||||
description: {
|
||||
en: 'Read by screen readers in the enlarged image view; leave a field empty to use the default.',
|
||||
pl: 'Odczytywane przez czytniki ekranu w podglądzie zdjęcia; zostaw pole puste, aby użyć domyślnej wartości.',
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
lightboxText('open', '50%', 'Button around a small image; its alt text follows after ": ".'),
|
||||
lightboxText('dialog', '50%', 'Name of the viewer window.'),
|
||||
lightboxText('open', { en: 'Enlarge button', pl: 'Przycisk powiększenia' }, '50%', {
|
||||
en: 'The image description is added after it.',
|
||||
pl: 'Po tekście dodawany jest opis zdjęcia.',
|
||||
}),
|
||||
lightboxText('dialog', { en: 'Viewer name', pl: 'Nazwa podglądu' }, '50%'),
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
lightboxText('previous', '25%'),
|
||||
lightboxText('next', '25%'),
|
||||
lightboxText('close', '25%'),
|
||||
lightboxText('counter', '25%', '{current} and {total} are replaced.'),
|
||||
lightboxText('previous', { en: 'Previous button', pl: 'Przycisk „Poprzednie”' }, '25%'),
|
||||
lightboxText('next', { en: 'Next button', pl: 'Przycisk „Następne”' }, '25%'),
|
||||
lightboxText('close', { en: 'Close button', pl: 'Przycisk „Zamknij”' }, '25%'),
|
||||
lightboxText('counter', { en: 'Image counter', pl: 'Licznik zdjęć' }, '25%', {
|
||||
en: 'Use {current} and {total} for the numbers.',
|
||||
pl: 'Użyj {current} i {total}, aby wstawić liczby.',
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
label: 'Lightbox',
|
||||
label: { en: 'Image viewer', pl: 'Podgląd zdjęć' },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user