- 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]>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import type { Field } from 'payload'
|
||
|
||
/**
|
||
* Theme behavior configuration.
|
||
*
|
||
* These are decisions, not visuals — the plugin stores them, the client
|
||
* template reads them and decides whether to render a toggle and which
|
||
* mode to start in. Appearance itself stays in the template.
|
||
*/
|
||
export const themeFields: Field[] = [
|
||
{
|
||
name: 'defaultTheme',
|
||
type: 'select',
|
||
admin: {
|
||
description: {
|
||
en: 'Used on a visitor’s first visit.',
|
||
pl: 'Używany przy pierwszej wizycie.',
|
||
},
|
||
},
|
||
defaultValue: 'light',
|
||
label: { en: 'Default theme', pl: 'Domyślny motyw' },
|
||
options: [
|
||
{ label: { en: 'Light', pl: 'Jasny' }, value: 'light' },
|
||
{ label: { en: 'Dark', pl: 'Ciemny' }, value: 'dark' },
|
||
{ label: { en: 'Device setting', pl: 'Ustawienie urządzenia' }, value: 'system' },
|
||
],
|
||
required: true,
|
||
},
|
||
{
|
||
name: 'allowThemeToggle',
|
||
type: 'checkbox',
|
||
defaultValue: true,
|
||
label: { en: 'Show theme switch', pl: 'Pokaż przełącznik motywu' },
|
||
},
|
||
{
|
||
name: 'themeToggleLabel',
|
||
type: 'text',
|
||
admin: {
|
||
condition: (data) => Boolean(data?.allowThemeToggle),
|
||
description: {
|
||
en: 'Read aloud by screen readers.',
|
||
pl: 'Odczytywana przez czytniki ekranu.',
|
||
},
|
||
placeholder: { en: 'Dark mode', pl: 'Tryb ciemny' },
|
||
},
|
||
label: { en: 'Switch label', pl: 'Etykieta przełącznika' },
|
||
localized: true,
|
||
},
|
||
]
|