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,5 +1,5 @@
|
||||
// Server-safe: pure helpers and types (no React state, no DOM).
|
||||
export { lightboxImage } from './lightboxImage.js'
|
||||
export type { LightboxImageOptions } from './lightboxImage.js'
|
||||
export { formatLightboxCounter, LIGHTBOX_FALLBACK, lightboxIndex, resolveLightboxTexts } from './texts.js'
|
||||
export { formatLightboxCounter, LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL, lightboxFallback, lightboxIndex, resolveLightboxTexts } from './texts.js'
|
||||
export type { LightboxClassNames, LightboxImage, LightboxRenderImage, LightboxTexts } from './types.js'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { LightboxTexts } from './types.js'
|
||||
|
||||
/**
|
||||
* English fallbacks, per field — the same philosophy as NOTIFICATION_FALLBACK.
|
||||
* Editors translate them in Notifications → Lightbox (ipalKit `lightbox: true`).
|
||||
* Editors translate them in Form messages → Image viewer (ipalKit `lightbox: true`).
|
||||
*/
|
||||
export const LIGHTBOX_FALLBACK: LightboxTexts = {
|
||||
close: 'Close',
|
||||
@@ -13,9 +13,26 @@ export const LIGHTBOX_FALLBACK: LightboxTexts = {
|
||||
previous: 'Previous image',
|
||||
}
|
||||
|
||||
/** Merges partial texts over the fallback; empty strings fall back too. */
|
||||
export function resolveLightboxTexts(texts?: null | Partial<Record<keyof LightboxTexts, null | string>>): LightboxTexts {
|
||||
const out = { ...LIGHTBOX_FALLBACK }
|
||||
/** Polish fallbacks — used on a page whose locale is Polish. */
|
||||
export const LIGHTBOX_FALLBACK_PL: LightboxTexts = {
|
||||
close: 'Zamknij',
|
||||
counter: '{current} / {total}',
|
||||
dialog: 'Podgląd zdjęcia',
|
||||
next: 'Następne zdjęcie',
|
||||
open: 'Powiększ zdjęcie',
|
||||
previous: 'Poprzednie zdjęcie',
|
||||
}
|
||||
|
||||
/** Fallbacks for a page language: Polish for 'pl' / 'pl-PL', English for anything else. */
|
||||
export const lightboxFallback = (locale?: string): LightboxTexts =>
|
||||
locale?.toLowerCase().startsWith('pl') ? LIGHTBOX_FALLBACK_PL : LIGHTBOX_FALLBACK
|
||||
|
||||
/** Merges partial texts over the fallback for `locale` (English when omitted); empty strings fall back too. */
|
||||
export function resolveLightboxTexts(
|
||||
texts?: null | Partial<Record<keyof LightboxTexts, null | string>>,
|
||||
locale?: string,
|
||||
): LightboxTexts {
|
||||
const out = { ...lightboxFallback(locale) }
|
||||
for (const key of Object.keys(out) as (keyof LightboxTexts)[]) {
|
||||
const value = texts?.[key]
|
||||
if (typeof value === 'string' && value.trim()) {out[key] = value}
|
||||
|
||||
Reference in New Issue
Block a user