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
+22 -12
View File
@@ -1,4 +1,7 @@
import type { StatsDay } from '../summarize.js'
import type { StatsI18n } from './statsI18n.js'
import { num, statsI18n, tr } from './statsI18n.js'
const W = 1000
const H = 220
@@ -18,14 +21,21 @@ function column(x: number, y: number, w: number, h: number): string {
return `M${x},${y + h}V${y + r}Q${x},${y} ${x + r},${y}H${x + w - r}Q${x + w},${y} ${x + w},${y + r}V${y + h}Z`
}
const shortDate = (day: string) => `${day.slice(8, 10)}.${day.slice(5, 7)}`
/** A `YYYY-MM-DD` day in the admin language: short (axis) or medium (table, tooltip). */
const dayLabel = (day: string, language: string, style: 'medium' | 'short') =>
new Intl.DateTimeFormat(
language,
style === 'short' ? { day: 'numeric', month: 'numeric', timeZone: 'UTC' } : { dateStyle: 'medium', timeZone: 'UTC' },
).format(new Date(`${day}T00:00:00Z`))
/**
* Visits per day — server-rendered SVG, no client JS. One series, so no
* legend: the heading names it. Each day has a full-height hover target with
* a native tooltip, and the numbers are in a table below for screen readers.
*/
export function VisitsChart({ days }: { days: StatsDay[] }) {
export function VisitsChart({ days, i18n: i18nProp }: { days: StatsDay[]; i18n?: StatsI18n }) {
const i18n = statsI18n(i18nProp)
const lang = i18n.language
const max = niceMax(Math.max(0, ...days.map((d) => d.visits)))
const plotW = W - PAD.left - PAD.right
const plotH = H - PAD.top - PAD.bottom
@@ -41,7 +51,7 @@ export function VisitsChart({ days }: { days: StatsDay[] }) {
<g key={t}>
<line className="ipal-stats-grid" x1={PAD.left} x2={W - PAD.right} y1={y(t)} y2={y(t)} />
<text className="ipal-stats-axis" dominantBaseline="middle" textAnchor="end" x={PAD.left - 6} y={y(t)}>
{Number.isInteger(t) ? t : t.toFixed(1)}
{num(i18n, t, { maximumFractionDigits: 1 })}
</text>
</g>
))}
@@ -51,12 +61,12 @@ export function VisitsChart({ days }: { days: StatsDay[] }) {
const label = i % 7 === (days.length - 1) % 7
return (
<g className="ipal-stats-day" key={d.day}>
<title>{`${d.day}: ${d.visits} visits, ${d.views} page views`}</title>
<title>{tr(i18n, 'statsChartDay', { day: dayLabel(d.day, lang, 'medium'), views: num(i18n, d.views), visits: num(i18n, d.visits) })}</title>
<rect fill="transparent" height={plotH} width={band} x={x} y={PAD.top} />
{h > 0 ? <path className="ipal-stats-bar" d={column(x + (band - barW) / 2, y(d.visits), barW, h)} /> : null}
{label ? (
<text className="ipal-stats-axis" textAnchor="middle" x={x + band / 2} y={H - 6}>
{shortDate(d.day)}
{dayLabel(d.day, lang, 'short')}
</text>
) : null}
</g>
@@ -64,21 +74,21 @@ export function VisitsChart({ days }: { days: StatsDay[] }) {
})}
</svg>
<details style={{ marginTop: '0.5rem' }}>
<summary>Table</summary>
<summary>{tr(i18n, 'statsChartTable')}</summary>
<table className="ipal-stats-table">
<thead>
<tr>
<th scope="col">Day</th>
<th scope="col">Visits</th>
<th scope="col">Page views</th>
<th scope="col">{tr(i18n, 'statsColDay')}</th>
<th scope="col">{tr(i18n, 'statsVisits')}</th>
<th scope="col">{tr(i18n, 'statsPageViews')}</th>
</tr>
</thead>
<tbody>
{[...days].reverse().map((d) => (
<tr key={d.day}>
<td>{d.day}</td>
<td>{d.visits}</td>
<td>{d.views}</td>
<td>{dayLabel(d.day, lang, 'medium')}</td>
<td>{num(i18n, d.visits)}</td>
<td>{num(i18n, d.views)}</td>
</tr>
))}
</tbody>