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
+14 -7
View File
@@ -28,15 +28,22 @@ function resolveKeys(integrations: IntegrationsWithTurnstileKeys) {
}
/**
* Why Turnstile is half-configured (only one of the two keys set), or null when
* it's fully on or fully off. Shown as a dashboard alert by IntegrationAlerts —
* the half-configured state silently turns Turnstile OFF, which an editor who
* just pasted one key wouldn't expect.
* Which key is missing when Turnstile is half-configured (only one of the two
* keys set), or null when it's fully on or fully off. The half-configured state
* silently turns Turnstile OFF, which an editor who just pasted one key wouldn't
* expect — IntegrationAlerts shows it on the dashboard.
*/
export function turnstileKeyProblem(integrations: IntegrationsWithTurnstileKeys): null | string {
export function turnstileMissingKey(integrations: IntegrationsWithTurnstileKeys): 'secret' | 'site' | null {
const { secret, siteKey } = resolveKeys(integrations)
if (Boolean(siteKey) === Boolean(secret)) {return null}
return `${siteKey ? 'Secret key' : 'Site key'} is missing, so Turnstile is OFF — forms are not protected. Fill in both keys (or clear both).`
return siteKey ? 'secret' : 'site'
}
/** Plain English explanation of a half-configured Turnstile, or null (see turnstileMissingKey). */
export function turnstileKeyProblem(integrations: IntegrationsWithTurnstileKeys): null | string {
const missing = turnstileMissingKey(integrations)
if (!missing) {return null}
return `The ${missing === 'secret' ? 'secret' : 'site'} key is missing, so spam protection is off. Fill in both keys or clear both.`
}
/**
@@ -68,7 +75,7 @@ export async function getTurnstileConfig(payload: BasePayload): Promise<Turnstil
warnedPartial = true
console.warn(
`[ipal] Turnstile is half-configured (${siteKey ? 'secret key' : 'site key'} missing) — ` +
'treating it as off. Fill in both keys in Site Integrations → Turnstile.',
'treating it as off. Fill in both keys in Site integrations → Spam protection.',
)
}
return { enabled: false, siteKey: null }
+17 -9
View File
@@ -59,17 +59,25 @@ const STATUS_FIELD = 'turnstileStatus'
export type TurnstileOutcome = 'degraded' | 'pass' | 'reject'
export type TurnstileCheck = { code?: string; outcome: TurnstileOutcome }
/** Cloudflare error codes caused by our configuration / Cloudflare itself — not by the visitor. */
/**
* Cloudflare error codes caused by our configuration / Cloudflare itself — not by the visitor.
* The messages are what the panel shows (in English; the banner and dashboard alert
* show these codes in the editor's language — integrations/texts.ts STATUS_CODE_TEXTS).
*/
const CONFIG_ERRORS: Record<string, string> = {
'internal-error': 'Cloudflare reported an internal error while verifying.',
'invalid-input-secret':
'Cloudflare rejected the secret key — check Site Integrations → Turnstile (secret and site key must come from the same widget).',
'missing-input-secret': 'The secret key is missing in the request.',
'internal-error': 'Cloudflare reported an internal error. It usually passes on its own.',
'invalid-input-secret': 'Cloudflare rejected the secret key. Both keys must come from the same widget.',
'missing-input-secret': 'The secret key is missing.',
}
const PLUGIN_ERRORS: Record<string, string> = {
'bad-response': 'Cloudflare returned an unexpected response.',
'missing-secret': `No secret key — fill in Site Integrations → Turnstile (or the ${ENV_SECRET} environment variable).`,
'network-error': 'The server could not reach Cloudflare (challenges.cloudflare.com).',
'bad-response': 'Cloudflare sent an unexpected response.',
'missing-secret': 'The secret key is missing.',
'network-error': 'The server could not reach Cloudflare.',
}
/** Developer detail for the server log only. */
const LOG_DETAIL: Record<string, string> = {
'missing-secret': `set it in Site integrations → Spam protection or the ${ENV_SECRET} environment variable`,
'network-error': 'challenges.cloudflare.com unreachable',
}
/**
@@ -94,7 +102,7 @@ export async function checkTurnstile({
const degraded = async (code: string): Promise<TurnstileCheck> => {
const message = PLUGIN_ERRORS[code] ?? CONFIG_ERRORS[code] ?? `Cloudflare error: ${code}`
console.warn(`[ipal] Turnstile degraded (${code}): ${message}`)
console.warn(`[ipal] Turnstile degraded (${code}): ${message}${LOG_DETAIL[code] ? ` (${LOG_DETAIL[code]})` : ''}`)
await recordIntegrationStatus(payload, STATUS_FIELD, previous, { code, message, state: 'degraded' })
return { code, outcome: 'degraded' }
}