Taalbestanden: indeling gelijk aan ASF (common, site, home, era), baseline-check van de prerender en lint-waarschuwingen voor losse tekst, docs/translations.md

Prerender-uitvoer blijft byte-identiek.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 20:40:51 +01:00
co-authored by Claude Sonnet 5.5
parent 6c6fd771dd
commit 2f614151df
32 changed files with 1405 additions and 104 deletions
+3
View File
@@ -33,3 +33,6 @@ npm-debug.log*
# Lighthouse CI # Lighthouse CI
lighthouse-reports/ lighthouse-reports/
.lighthouseci/ .lighthouseci/
# Text baseline (pnpm baseline:save)
.baseline/
+59
View File
@@ -0,0 +1,59 @@
# Texts and translations
The static texts of the site live in language files, not in the components. Dutch is the only language now; the structure allows a second one without touching the components.
## Where things are
- `src/i18n/nl/*.json`: the Dutch texts, one file per namespace. The files are the source of the types.
- `src/i18n/index.ts`: `t(key, params?)`, `tList(key)` and the `TextKey` type.
- `src/i18n/i18n.test.ts`: tests for the helpers and the language files.
## Namespaces
| Namespace | Holds |
| --------- | ---------------------------------------------------------------------------------------------- |
| `common` | Texts used all over the site: navigation, footer, buttons, aria labels, error and alert texts. |
| `site` | Site-wide texts: page title, meta description, structured data. |
| `home` | The texts of the landing page sections (about, packages intro, contact form, and so on). |
| `era` | The texts of the 2026 era variant of the landing page. |
(Target layout. The files were called `shared` and `landing` before; if you find those names in older notes, `common` and `site`/`home` replace them.)
## Keys and placeholders
A key is a dotted path: the namespace, then the section, then the element, for example `home.contact.submit` or `common.aria.backToTop`. A list of plain texts is an array in the JSON and keeps the order of the page. A text may contain `{name}` placeholders, filled in from the second argument: `t('home.contact.thanks', { name })`. A placeholder that is not given stays as it is in the text. There is no HTML in the texts; a text with a link or emphasis is split into parts in the component.
## Reading a text
- `t('home.about.title')` returns one text, with placeholders replaced.
- `tList('home.about.points')` returns an array of texts.
- `TextKey` is the union of all keys that exist, so a typo or a removed key stops `tsc -b` (and therefore `pnpm build`). Do not build keys at run time with template strings.
## What is deliberately not in the language files
- The Hero (component and hero data): it becomes a CMS module.
- Everything that comes from the CMS: packages, banners, and so on.
- `src/cms-client`: it is a movable package and has its own messages (`messages.nl.ts`); it may not import from the app.
- The privacy statement: it is its own feature and has its own text.
ESLint knows these exceptions: `react/jsx-no-literals` and a rule for text attributes (`aria-label`, `aria-description`, `alt`, `title`, `placeholder`, `label`) warn about a text typed straight into JSX in `src/**/*.tsx`, except in the Hero, tests and the privacy statement. Single technical signs (`/`, `|`, `-`, `:`, and so on), whitespace and numbers are allowed. They are warnings for now; they become errors when the move is done.
## Adding a second language
1. Copy `src/i18n/nl` to `src/i18n/<code>` and translate the values. Keys and `{placeholders}` stay the same.
2. Type it against the Dutch files (for example `satisfies typeof nl`) so a missing key is a compile error, and add a test that both languages have the same keys and placeholders.
3. Make `t()` and `tList()` read from the active language (a `locale` in `src/i18n/index.ts`) instead of `nl` directly.
4. The site needs a way to choose the language, `<html lang>` from the language, and a prerender per language. That is separate work; the texts do not stand in its way.
## Checking that nothing changed
When texts are moved into the language files, the prerendered page has to stay word for word the same.
```
pnpm build # tsc -b, vite build and the prerender
pnpm baseline:save # before the change: stores .baseline/index.html (not in git)
# ... make the change, then build again
pnpm baseline:check # compares dist/index.html with the baseline; exit code 1 and a diff if it differs
```
The baseline keeps the text, links, labels, meta tags, structured data (JSON-LD) and a CMS data block if there is one. Formatting, scripts, styles, class names and asset hashes are ignored. The code is in `scripts/htmlBaseline.mjs`, with tests in `scripts/htmlBaseline.test.mjs`.
+55
View File
@@ -1,5 +1,6 @@
import js from '@eslint/js'; import js from '@eslint/js';
import globals from 'globals'; import globals from 'globals';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks'; import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh'; import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint'; import tseslint from 'typescript-eslint';
@@ -23,6 +24,60 @@ export default tseslint.config(
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
}, },
}, },
{
// Texts of the site live in the language files (src/i18n), not in the JSX. A warning for now while
// the components are moved over. Left out: the Hero (becomes a CMS module), tests and the privacy
// statement (its own feature).
files: ['src/**/*.tsx'],
ignores: [
'**/Hero.tsx',
'**/Hero/**',
'**/hero/**',
'**/*.test.tsx',
'**/__tests__/**',
'src/test/**',
'**/*rivacy*',
'**/*rivacy*/**',
],
plugins: { react },
rules: {
// Text in attributes that people read or hear (labels, alt text)
'no-restricted-syntax': [
'warn',
{
selector:
"JSXAttribute[name.name=/^(aria-label|aria-description|alt|title|placeholder|label)$/][value.type='Literal']",
message: 'Put the text in a language file (src/i18n) and use t().',
},
],
'react/jsx-no-literals': [
'warn',
{
noStrings: false,
ignoreProps: true,
// Technical signs that are not words
allowedStrings: [
'/',
'|',
'·',
'–',
'—',
'×',
'+',
'-',
':',
'…',
'.',
',',
'(',
')',
'&',
'©',
],
},
],
},
},
{ {
// src/cms-client is a movable package (future SlpModularCms package): no imports from the app. // src/cms-client is a movable package (future SlpModularCms package): no imports from the app.
files: ['src/cms-client/**/*.{ts,tsx}'], files: ['src/cms-client/**/*.{ts,tsx}'],
+3
View File
@@ -11,6 +11,8 @@
"test:watch": "vitest", "test:watch": "vitest",
"lint": "eslint .", "lint": "eslint .",
"lighthouse": "lhci autorun && lhci autorun --config=lighthouserc.desktop.cjs", "lighthouse": "lhci autorun && lhci autorun --config=lighthouserc.desktop.cjs",
"baseline:save": "node scripts/htmlBaseline.mjs save",
"baseline:check": "node scripts/htmlBaseline.mjs check",
"format": "prettier --write ." "format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
@@ -36,6 +38,7 @@
"@vitejs/plugin-react": "^4.3.2", "@vitejs/plugin-react": "^4.3.2",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.13.0", "eslint": "^9.13.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.12", "eslint-plugin-react-refresh": "^0.4.12",
"fast-check": "^4.10.2", "fast-check": "^4.10.2",
+1007
View File
File diff suppressed because it is too large Load Diff
+103
View File
@@ -0,0 +1,103 @@
// Safety net for moving texts into the language files: saves what the prerendered page says
// (text, links, labels, meta tags, structured data and the CMS data block, if present) and later
// checks that a new build says exactly the same. Styling, scripts, asset hashes and generated class
// names are left out, so only a change of wording or content shows up.
//
// Usage (after `pnpm build`, or `vite build && node scripts/prerender.mjs`):
// node scripts/htmlBaseline.mjs save writes .baseline/index.html (ignored by git)
// node scripts/htmlBaseline.mjs check compares dist/index.html with .baseline (exit code 1 on a difference)
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
const DIST_FILE = join('dist', 'index.html');
const BASELINE_DIR = '.baseline';
const BASELINE_FILE = join(BASELINE_DIR, 'index.html');
// What stays of the scripts: structured data and data blocks, not code
const KEEP_SCRIPT = /type="application\/(?:ld\+json|json)"/;
export function normalizeHtml(html) {
return (
html
.replace(/<!--(?!\/?CMS:)[\s\S]*?-->/g, '')
.replace(/<style[\s\S]*?<\/style>/g, '')
.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g, (all, attrs) =>
KEEP_SCRIPT.test(attrs) ? all : '',
)
.replace(/<noscript>[\s\S]*?<\/noscript>/g, '<noscript></noscript>')
// Only the canonical link is content; the others point to hashed files
.replace(/<link\b[^>]*>/g, (tag) => (/rel="canonical"/.test(tag) ? tag : ''))
// Look, not content
.replace(/\s(?:class|style|data-emotion|data-reveal)="[^"]*"/g, '')
// The hash in /assets/name-Hash.ext
.replace(/(\/assets\/[\w.-]*?)-[A-Za-z0-9_-]{8}(\.[a-z0-9]+)/g, '$1$2')
// Line breaks and indentation inside a tag are formatting
.replace(/<[a-zA-Z][^>]*>/g, (tag) => tag.replace(/\s+/g, ' ').replace(/\s+(\/?>)$/, '$1'))
.replace(/>\s+</g, '><')
// One tag per line, so a difference is readable
.replace(/></g, '>\n<')
.trim() + '\n'
);
}
// The first lines that differ, for the message
export function firstDifferences(a, b, max = 6) {
const left = a.split('\n');
const right = b.split('\n');
const out = [];
for (let i = 0; i < Math.max(left.length, right.length) && out.length < max * 3; i++) {
if (left[i] !== right[i]) {
out.push(
` regel ${i + 1}:`,
` basislijn: ${left[i] ?? '(geen)'}`,
` nu: ${right[i] ?? '(geen)'}`,
);
}
}
return out;
}
function readDist() {
if (!existsSync(DIST_FILE)) {
console.error(`${DIST_FILE} bestaat niet; draai eerst \`pnpm build\`.`);
return null;
}
return normalizeHtml(readFileSync(DIST_FILE, 'utf8'));
}
function save() {
const now = readDist();
if (now === null) return false;
mkdirSync(BASELINE_DIR, { recursive: true });
writeFileSync(BASELINE_FILE, now);
console.log(`Basislijn opgeslagen in ${BASELINE_FILE}`);
return true;
}
function check() {
if (!existsSync(BASELINE_FILE)) {
console.error('Geen basislijn; draai eerst `pnpm baseline:save`.');
return false;
}
const now = readDist();
if (now === null) return false;
const was = readFileSync(BASELINE_FILE, 'utf8');
if (now !== was) {
console.error('index.html: tekst verschilt van de basislijn');
console.error(firstDifferences(was, now).join('\n'));
return false;
}
console.log('Gelijk aan de basislijn: index.html');
return true;
}
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
const command = process.argv[2];
if (command === 'save') process.exitCode = save() ? 0 : 1;
else if (command === 'check') process.exitCode = check() ? 0 : 1;
else {
console.error('Gebruik: node scripts/htmlBaseline.mjs save|check');
process.exitCode = 2;
}
}
+69
View File
@@ -0,0 +1,69 @@
import { describe, expect, it } from 'vitest';
import { firstDifferences, normalizeHtml } from './htmlBaseline.mjs';
describe('normalizeHtml', () => {
it('keeps text, links, labels, meta, structured data and the data block', () => {
const html =
'<html><head><title>Titel</title><meta name="description" content="Tekst"/>' +
'<link rel="canonical" href="https://a.nl/"/></head><body>' +
'<a href="/over-mij" aria-label="Naar over mij">Over mij</a>' +
'<script type="application/ld+json">{"a":1}</script>' +
'<script type="application/json" id="cms">{"b":2}</script></body></html>';
const out = normalizeHtml(html);
for (const part of [
'<title>Titel</title>',
'content="Tekst"',
'rel="canonical"',
'aria-label="Naar over mij"',
'Over mij',
'{"a":1}',
'{"b":2}',
]) {
expect(out).toContain(part);
}
});
it('leaves out look and build details', () => {
const html =
'<style>.a{}</style><script type="module" src="/assets/x-AbCd1234.js"></script>' +
'<link rel="stylesheet" href="/assets/y-AbCd1234.css"/><!-- opmerking -->' +
'<div class="css-1abc" style="color:red" id="x">tekst</div>' +
'<img src="/assets/foto-AbCd1234.jpg"/><noscript><style>.b{}</style></noscript>';
const out = normalizeHtml(html);
expect(out).not.toMatch(/css-1abc|color:red|opmerking|\.a\{|stylesheet|AbCd1234\.js/);
expect(out).toContain('<div id="x">');
expect(out).toContain('/assets/foto.jpg');
expect(out).toContain('<noscript>\n</noscript>');
});
it('ignores formatting but notices a changed text', () => {
const a = normalizeHtml('<p>Hallo</p>\n\n <p>wereld</p>');
const b = normalizeHtml('<p>Hallo</p><p>wereld</p>');
expect(a).toBe(b);
expect(normalizeHtml('<p>Hallo</p><p>werelden</p>')).not.toBe(a);
});
});
describe('firstDifferences', () => {
it('reports the lines that differ and nothing for equal input', () => {
expect(firstDifferences('a\nb', 'a\nb')).toEqual([]);
const out = firstDifferences('a\nb\nc', 'a\nx\nc').join('\n');
expect(out).toContain('regel 2');
expect(out).toContain('basislijn: b');
expect(out).toContain('nu: x');
});
it('limits the number of reported differences', () => {
const many = Array.from({ length: 20 }, (_, i) => `r${i}`).join('\n');
const other = Array.from({ length: 20 }, (_, i) => `s${i}`).join('\n');
expect(firstDifferences(many, other, 2)).toHaveLength(6);
});
});
describe('normalizeHtml tags', () => {
it('ignores line breaks and indentation inside a tag', () => {
expect(normalizeHtml('<meta\n property="a"\n content="b"\n />')).toBe(
normalizeHtml('<meta property="a" content="b"/>'),
);
});
});
+1 -1
View File
@@ -4,7 +4,7 @@ export function Footer() {
return ( return (
<footer className="bg-inv text-[#b9b3ae]"> <footer className="bg-inv text-[#b9b3ae]">
<div className="mx-auto flex max-w-[1280px] flex-wrap justify-between gap-3 p-8 text-sm"> <div className="mx-auto flex max-w-[1280px] flex-wrap justify-between gap-3 p-8 text-sm">
<span>{t('landing.footer.copyright')}</span> <span>{t('site.footer.copyright')}</span>
<span className="font-mono">slp.Bouw(uwIdee);</span> <span className="font-mono">slp.Bouw(uwIdee);</span>
</div> </div>
</footer> </footer>
+2 -2
View File
@@ -13,7 +13,7 @@ import { t } from '../../i18n';
export function Nav() { export function Nav() {
const [isMenuOpen, setIsMenuOpen] = useState(false); const [isMenuOpen, setIsMenuOpen] = useState(false);
const sectionLinks = navLinks.filter((link) => !link.isCta); const sectionLinks = navLinks.filter((link) => !link.isCta);
const menuLabel = isMenuOpen ? t('landing.nav.menuClose') : t('landing.nav.menuOpen'); const menuLabel = isMenuOpen ? t('site.nav.menuClose') : t('site.nav.menuOpen');
// Escape closes the mobile menu (keyboard users). // Escape closes the mobile menu (keyboard users).
useEffect(() => { useEffect(() => {
@@ -32,7 +32,7 @@ export function Nav() {
return ( return (
<nav <nav
aria-label={t('landing.nav.label')} aria-label={t('site.nav.label')}
className="sticky top-0 z-40 bg-brand text-on-brand md:static" className="sticky top-0 z-40 bg-brand text-on-brand md:static"
> >
<div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-4 px-6 sm:px-8"> <div className="mx-auto flex min-h-[84px] max-w-[1280px] items-center justify-between gap-4 px-6 sm:px-8">
+1 -1
View File
@@ -18,7 +18,7 @@ export function SkipLink() {
className="sr-only z-50 bg-white px-4 py-3 text-base font-bold text-[#0e0d0d] focus:not-sr-only focus:fixed focus:left-4 focus:top-4" className="sr-only z-50 bg-white px-4 py-3 text-base font-bold text-[#0e0d0d] focus:not-sr-only focus:fixed focus:left-4 focus:top-4"
data-testid="skip-link" data-testid="skip-link"
> >
{t('shared.skipLink')} {t('common.aria.skipLink')}
</a> </a>
); );
} }
+4 -4
View File
@@ -15,23 +15,23 @@ export function VariantAlert() {
data-testid="variant-alert" data-testid="variant-alert"
className="fixed bottom-4 left-1/2 z-[110] flex w-[min(92vw,28rem)] -translate-x-1/2 flex-wrap items-center gap-3 rounded border border-accent-line bg-surface px-4 py-3 text-sm text-text shadow-lg" className="fixed bottom-4 left-1/2 z-[110] flex w-[min(92vw,28rem)] -translate-x-1/2 flex-wrap items-center gap-3 rounded border border-accent-line bg-surface px-4 py-3 text-sm text-text shadow-lg"
> >
<span className="flex-1">{t('shared.variantAlert.message')}</span> <span className="flex-1">{t('common.alert.message')}</span>
<button <button
type="button" type="button"
onClick={retryVariant} onClick={retryVariant}
data-testid="variant-alert-retry" data-testid="variant-alert-retry"
className="rounded border border-line px-3 py-1.5 font-medium hover:border-accent-line" className="rounded border border-line px-3 py-1.5 font-medium hover:border-accent-line"
> >
{t('shared.variantAlert.retry')} {t('common.alert.retry')}
</button> </button>
<button <button
type="button" type="button"
onClick={dismissVariantError} onClick={dismissVariantError}
aria-label={t('shared.variantAlert.dismissLabel')} aria-label={t('common.alert.dismissLabel')}
data-testid="variant-alert-dismiss" data-testid="variant-alert-dismiss"
className="rounded px-2 py-1.5 text-muted hover:text-text" className="rounded px-2 py-1.5 text-muted hover:text-text"
> >
{t('shared.variantAlert.dismiss')} {t('common.alert.dismiss')}
</button> </button>
</div> </div>
); );
+1 -1
View File
@@ -35,7 +35,7 @@ export class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundarySt
role="alert" role="alert"
data-testid="error-boundary-fallback" data-testid="error-boundary-fallback"
> >
<p className="font-display text-lg">{t('shared.errorBoundary')}</p> <p className="font-display text-lg">{t('common.error.boundary')}</p>
</div> </div>
); );
} }
+2 -2
View File
@@ -14,9 +14,9 @@ export function ModeToggle({ tone = 'default' }: { tone?: ToggleTone }) {
<button <button
type="button" type="button"
onClick={toggleMode} onClick={toggleMode}
aria-label={t('shared.toggles.darkMode')} aria-label={t('common.aria.darkMode')}
aria-pressed={isDark} aria-pressed={isDark}
title={t('shared.toggles.darkMode')} title={t('common.aria.darkMode')}
data-testid="mode-toggle-button" data-testid="mode-toggle-button"
className={`flex h-11 w-11 items-center justify-center rounded-full border transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 sm:h-8 sm:w-8 ${TONE_CLASSES[tone]}`} className={`flex h-11 w-11 items-center justify-center rounded-full border transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 sm:h-8 sm:w-8 ${TONE_CLASSES[tone]}`}
> >
+1 -1
View File
@@ -9,7 +9,7 @@ import { t } from '../../i18n';
export function VariantToggle({ tone = 'default' }: { tone?: ToggleTone }) { export function VariantToggle({ tone = 'default' }: { tone?: ToggleTone }) {
const { variant, toggleVariant, transition } = useTheme(); const { variant, toggleVariant, transition } = useTheme();
const inE = variant === 'e'; const inE = variant === 'e';
const label = inE ? t('shared.toggles.variantBack') : t('shared.toggles.variantToTimeTravel'); const label = inE ? t('common.aria.variantBack') : t('common.aria.variantToTimeTravel');
return ( return (
<button <button
@@ -22,7 +22,7 @@ export function AboutSection() {
src="/bryan-slop-800.jpg" src="/bryan-slop-800.jpg"
srcSet="/bryan-slop-400.jpg 400w, /bryan-slop-800.jpg 800w" srcSet="/bryan-slop-400.jpg 400w, /bryan-slop-800.jpg 800w"
sizes="(min-width: 768px) 480px, 90vw" sizes="(min-width: 768px) 480px, 90vw"
alt={t('landing.about.photoAlt')} alt={t('home.about.photoAlt')}
width={480} width={480}
height={640} height={640}
loading="lazy" loading="lazy"
@@ -36,7 +36,7 @@ export function AboutSection() {
id="over-heading" id="over-heading"
className="mb-9 text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%]" className="mb-9 text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%]"
> >
{t('landing.about.heading')} {t('home.about.heading')}
</h2> </h2>
{aboutContent.paragraphs.map((paragraph) => ( {aboutContent.paragraphs.map((paragraph) => (
<p key={paragraph} className="mb-[18px] max-w-[52ch] text-body"> <p key={paragraph} className="mb-[18px] max-w-[52ch] text-body">
@@ -90,7 +90,7 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
data-testid="contact-success" data-testid="contact-success"
> >
<p className="mb-3 text-[clamp(30px,3.4vw,44px)] font-extrabold leading-none tracking-[-0.02em] [font-stretch:112%]"> <p className="mb-3 text-[clamp(30px,3.4vw,44px)] font-extrabold leading-none tracking-[-0.02em] [font-stretch:112%]">
{t('landing.contact.form.successTitle')} {t('home.contact.form.successTitle')}
</p> </p>
<p className="mb-7 text-body">{contactForm.successText}</p> <p className="mb-7 text-body">{contactForm.successText}</p>
<button <button
@@ -99,7 +99,7 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
className="min-h-[44px] bg-text px-[22px] py-[15px] text-[15px] font-bold text-panel transition-colors hover:bg-brand hover:text-on-brand" className="min-h-[44px] bg-text px-[22px] py-[15px] text-[15px] font-bold text-panel transition-colors hover:bg-brand hover:text-on-brand"
data-testid="contact-reset" data-testid="contact-reset"
> >
{t('landing.contact.form.reset')} {t('home.contact.form.reset')}
</button> </button>
</div> </div>
); );
@@ -114,21 +114,17 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
return ( return (
<form {...form.formProps} className="flex flex-col gap-6" data-testid="contact-form"> <form {...form.formProps} className="flex flex-col gap-6" data-testid="contact-form">
<div className="grid grid-cols-1 gap-5 sm:grid-cols-2"> <div className="grid grid-cols-1 gap-5 sm:grid-cols-2">
<Field label={t('landing.contact.form.name')} error={name.error} errorId={name.errorId}> <Field label={t('home.contact.form.name')} error={name.error} errorId={name.errorId}>
<input type="text" autoComplete="name" className={INPUT} {...name.inputProps} /> <input type="text" autoComplete="name" className={INPUT} {...name.inputProps} />
</Field> </Field>
<Field label={t('landing.contact.form.email')} error={email.error} errorId={email.errorId}> <Field label={t('home.contact.form.email')} error={email.error} errorId={email.errorId}>
<input type="email" autoComplete="email" className={INPUT} {...email.inputProps} /> <input type="email" autoComplete="email" className={INPUT} {...email.inputProps} />
</Field> </Field>
</div> </div>
<Field <Field label={t('home.contact.form.subject')} error={subject.error} errorId={subject.errorId}>
label={t('landing.contact.form.subject')}
error={subject.error}
errorId={subject.errorId}
>
<select className={INPUT} {...subject.inputProps}> <select className={INPUT} {...subject.inputProps}>
<option value="" disabled> <option value="" disabled>
{t('landing.contact.form.subjectPlaceholder')} {t('home.contact.form.subjectPlaceholder')}
</option> </option>
{subjectOptions.map((option) => ( {subjectOptions.map((option) => (
<option key={option.value} value={option.value}> <option key={option.value} value={option.value}>
@@ -137,17 +133,13 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
))} ))}
</select> </select>
</Field> </Field>
<Field <Field label={t('home.contact.form.message')} error={message.error} errorId={message.errorId}>
label={t('landing.contact.form.message')}
error={message.error}
errorId={message.errorId}
>
<textarea rows={5} className={`${INPUT} resize-y`} {...message.inputProps} /> <textarea rows={5} className={`${INPUT} resize-y`} {...message.inputProps} />
</Field> </Field>
{/* Honeypot: invisible to people and assistive technology; bots fill it (BR-U4-7). */} {/* Honeypot: invisible to people and assistive technology; bots fill it (BR-U4-7). */}
<div aria-hidden="true" className="absolute -left-[9999px] h-0 w-0 overflow-hidden"> <div aria-hidden="true" className="absolute -left-[9999px] h-0 w-0 overflow-hidden">
<label htmlFor={hpId}>{t('landing.contact.form.honeypot')}</label> <label htmlFor={hpId}>{t('home.contact.form.honeypot')}</label>
<input type="text" id={hpId} {...hpProps} /> <input type="text" id={hpId} {...hpProps} />
</div> </div>
@@ -188,8 +180,8 @@ export function ContactFormView({ client, token, refreshToken }: ContactFormView
{form.status === 'sending' {form.status === 'sending'
? form.messages.sendingLabel ? form.messages.sendingLabel
: form.status === 'failed' : form.status === 'failed'
? t('landing.contact.form.retry') ? t('home.contact.form.retry')
: t('landing.contact.form.submit')} : t('home.contact.form.submit')}
</button> </button>
<p className="-mt-2 text-[13px] text-muted">{contactForm.privacyNote}</p> <p className="-mt-2 text-[13px] text-muted">{contactForm.privacyNote}</p>
</form> </form>
@@ -25,7 +25,7 @@ export function ContactSection({ panel = <ContactPanel /> }: { panel?: ReactNode
<div className="mt-12 flex flex-wrap items-end justify-between gap-x-16 gap-y-10 md:mt-[72px]"> <div className="mt-12 flex flex-wrap items-end justify-between gap-x-16 gap-y-10 md:mt-[72px]">
<div className="flex-[1_1_320px] self-start"> <div className="flex-[1_1_320px] self-start">
<p className="mb-10 max-w-[40ch] text-[19px]">{contactInfo.description}</p> <p className="mb-10 max-w-[40ch] text-[19px]">{contactInfo.description}</p>
<p className="mb-2 text-[15px] font-semibold">{t('landing.contact.directMail')}</p> <p className="mb-2 text-[15px] font-semibold">{t('home.contact.directMail')}</p>
<a <a
href={`mailto:${contactInfo.email}`} href={`mailto:${contactInfo.email}`}
className="break-words text-[clamp(24px,2.6vw,36px)] font-bold tracking-[-0.02em] underline decoration-[3px] underline-offset-8 [font-stretch:112%]" className="break-words text-[clamp(24px,2.6vw,36px)] font-bold tracking-[-0.02em] underline decoration-[3px] underline-offset-8 [font-stretch:112%]"
@@ -10,11 +10,7 @@ interface FilterChipsProps {
/** Square filter chips of design B (BR-U3-3, BR-U3-11). */ /** Square filter chips of design B (BR-U3-3, BR-U3-11). */
export function FilterChips({ chips, activeId, onSelect }: FilterChipsProps) { export function FilterChips({ chips, activeId, onSelect }: FilterChipsProps) {
return ( return (
<div <div role="group" aria-label={t('home.packages.filterLabel')} className="flex flex-wrap gap-2">
role="group"
aria-label={t('landing.packages.filterLabel')}
className="flex flex-wrap gap-2"
>
{chips.map((chip) => { {chips.map((chip) => {
const active = chip.id === activeId; const active = chip.id === activeId;
return ( return (
@@ -8,15 +8,15 @@ export function MailtoPanel() {
return ( return (
<div data-testid="mailto-panel"> <div data-testid="mailto-panel">
<p className="mb-3 text-[clamp(28px,3vw,40px)] font-extrabold leading-none tracking-[-0.02em] [font-stretch:112%]"> <p className="mb-3 text-[clamp(28px,3vw,40px)] font-extrabold leading-none tracking-[-0.02em] [font-stretch:112%]">
{t('landing.contact.mailto.title')} {t('home.contact.mailto.title')}
</p> </p>
<p className="mb-7 max-w-[44ch] text-body">{t('landing.contact.mailto.text')}</p> <p className="mb-7 max-w-[44ch] text-body">{t('home.contact.mailto.text')}</p>
<a <a
href={mailtoHref} href={mailtoHref}
className="inline-block bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand no-underline transition-colors hover:bg-text hover:text-bg" className="inline-block bg-brand px-6 py-[18px] text-[17px] font-bold text-on-brand no-underline transition-colors hover:bg-text hover:text-bg"
data-testid="contact-mailto-button" data-testid="contact-mailto-button"
> >
{t('landing.contact.mailto.button')} {t('home.contact.mailto.button')}
</a> </a>
</div> </div>
); );
@@ -17,7 +17,7 @@ export function PackageCard({ pkg }: { pkg: PackageCardData }) {
> >
{featured && ( {featured && (
<span className="absolute right-0 top-0 bg-[#0e0d0d] px-3.5 py-2 text-[13px] font-bold text-white"> <span className="absolute right-0 top-0 bg-[#0e0d0d] px-3.5 py-2 text-[13px] font-bold text-white">
{t('landing.packages.featuredBadge')} {t('home.packages.featuredBadge')}
</span> </span>
)} )}
<h3 <h3
@@ -35,7 +35,7 @@ export function PackageList({ packages, loading = false, resetKey }: PackageList
<div <div
ref={ref} ref={ref}
role="group" role="group"
aria-label={t('landing.packages.listLabel')} aria-label={t('home.packages.listLabel')}
tabIndex={0} tabIndex={0}
data-testid="packages-grid" data-testid="packages-grid"
className="-mx-6 flex snap-x snap-mandatory items-stretch gap-4 overflow-x-auto px-6 pb-2 sm:mx-0 sm:flex-wrap sm:justify-center sm:snap-none sm:overflow-visible sm:px-0 sm:pb-0" className="-mx-6 flex snap-x snap-mandatory items-stretch gap-4 overflow-x-auto px-6 pb-2 sm:mx-0 sm:flex-wrap sm:justify-center sm:snap-none sm:overflow-visible sm:px-0 sm:pb-0"
@@ -10,7 +10,7 @@ import { PackageList } from './PackageList';
import { t } from '../../../i18n'; import { t } from '../../../i18n';
function headingFor(count: number): string { function headingFor(count: number): string {
return count === 3 ? t('landing.packages.headingThree') : t('landing.packages.headingOther'); return count === 3 ? t('home.packages.headingThree') : t('home.packages.headingOther');
} }
/** /**
@@ -40,26 +40,26 @@ export function PackagesSection() {
> >
{headingFor(loaded ? filter.cards.length : 3)}. {headingFor(loaded ? filter.cards.length : 3)}.
</h2> </h2>
<p className="max-w-[40ch] text-body">{t('landing.packages.intro')}</p> <p className="max-w-[40ch] text-body">{t('home.packages.intro')}</p>
</div> </div>
{topBanner ? <OfferingTopBanner banner={topBanner} /> : null} {topBanner ? <OfferingTopBanner banner={topBanner} /> : null}
{isError ? ( {isError ? (
<div className="text-center" data-testid="packages-error" role="alert"> <div className="text-center" data-testid="packages-error" role="alert">
<p className="mb-4 text-muted">{t('landing.packages.error')}</p> <p className="mb-4 text-muted">{t('home.packages.error')}</p>
<button <button
type="button" type="button"
onClick={() => void refetch()} onClick={() => void refetch()}
data-testid="packages-retry" data-testid="packages-retry"
className="min-h-[44px] border-2 border-text px-5 text-[15px] font-bold" className="min-h-[44px] border-2 border-text px-5 text-[15px] font-bold"
> >
{t('landing.packages.retry')} {t('home.packages.retry')}
</button> </button>
</div> </div>
) : loaded && data.length === 0 ? ( ) : loaded && data.length === 0 ? (
<div data-testid="packages-empty"> <div data-testid="packages-empty">
<p className="mb-4 text-muted">{t('landing.packages.empty')}</p> <p className="mb-4 text-muted">{t('home.packages.empty')}</p>
{banner} {banner}
</div> </div>
) : ( ) : (
@@ -11,7 +11,7 @@ export function ProcessSection() {
id="werkwijze-heading" id="werkwijze-heading"
className="mb-16 max-w-[14ch] text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%] md:mb-[88px]" className="mb-16 max-w-[14ch] text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%] md:mb-[88px]"
> >
{t('landing.process.heading')} {t('home.process.heading')}
</h2> </h2>
<ol className="grid grid-cols-1 gap-x-10 gap-y-16 md:grid-cols-3"> <ol className="grid grid-cols-1 gap-x-10 gap-y-16 md:grid-cols-3">
{processSteps.map((step, index) => ( {processSteps.map((step, index) => (
@@ -19,7 +19,7 @@ export function SwipeDots({ titles, activeIndex, onSelect }: SwipeDotsProps) {
<button <button
key={`${title}-${index}`} key={`${title}-${index}`}
type="button" type="button"
aria-label={t('landing.packages.swipeDot', { aria-label={t('home.packages.swipeDot', {
index: index + 1, index: index + 1,
total: titles.length, total: titles.length,
title, title,
+19 -19
View File
@@ -83,10 +83,10 @@ export interface ContactInfo {
} }
export const navLinks: NavLink[] = [ export const navLinks: NavLink[] = [
{ label: t('landing.nav.about'), href: '#over' }, { label: t('site.nav.about'), href: '#over' },
{ label: t('landing.nav.packages'), href: '#pakketten' }, { label: t('site.nav.packages'), href: '#pakketten' },
{ label: t('landing.nav.process'), href: '#werkwijze' }, { label: t('site.nav.process'), href: '#werkwijze' },
{ label: t('landing.nav.cta'), href: '#contact', isCta: true }, { label: t('site.nav.cta'), href: '#contact', isCta: true },
]; ];
export const heroContent: HeroContent = { export const heroContent: HeroContent = {
@@ -160,33 +160,33 @@ export const packagesSettings: PackagesSettings = {
}; };
export const processSteps: ProcessStepData[] = (['intake', 'build', 'live'] as const).map((id) => ({ export const processSteps: ProcessStepData[] = (['intake', 'build', 'live'] as const).map((id) => ({
label: t(`landing.process.steps.${id}.label`), label: t(`home.process.steps.${id}.label`),
phase: t(`landing.process.steps.${id}.phase`), phase: t(`home.process.steps.${id}.phase`),
title: t(`landing.process.steps.${id}.title`), title: t(`home.process.steps.${id}.title`),
description: t(`landing.process.steps.${id}.description`), description: t(`home.process.steps.${id}.description`),
})); }));
export const aboutContent: AboutContent = { export const aboutContent: AboutContent = {
paragraphs: [...tList('landing.about.paragraphs')], paragraphs: [...tList('home.about.paragraphs')],
}; };
export const aboutFacts: AboutFact[] = (['contact', 'response', 'price'] as const).map((id) => ({ export const aboutFacts: AboutFact[] = (['contact', 'response', 'price'] as const).map((id) => ({
title: t(`landing.about.facts.${id}.title`), title: t(`home.about.facts.${id}.title`),
text: t(`landing.about.facts.${id}.text`), text: t(`home.about.facts.${id}.text`),
})); }));
/** Texts of the contact form (design B). */ /** Texts of the contact form (design B). */
export const contactForm = { export const contactForm = {
otherSubjectLabel: t('landing.contact.form.otherSubject'), otherSubjectLabel: t('home.contact.form.otherSubject'),
successText: t('landing.contact.form.successText'), successText: t('home.contact.form.successText'),
captchaProblem: t('landing.contact.form.captchaProblem'), captchaProblem: t('home.contact.form.captchaProblem'),
privacyNote: t('landing.contact.form.privacyNote'), privacyNote: t('home.contact.form.privacyNote'),
}; };
export const contactInfo: ContactInfo = { export const contactInfo: ContactInfo = {
heading: t('landing.contact.heading'), heading: t('home.contact.heading'),
displayHeading: [...tList('landing.contact.displayHeading')], displayHeading: [...tList('home.contact.displayHeading')],
description: t('landing.contact.description'), description: t('home.contact.description'),
email: 'info@slpsoftware.nl', email: 'info@slpsoftware.nl',
mailSubject: t('landing.contact.mailSubject'), mailSubject: t('home.contact.mailSubject'),
}; };
+4 -3
View File
@@ -1,6 +1,7 @@
import landing from './nl/landing.json'; import home from './nl/home.json';
import era from './nl/era.json'; import era from './nl/era.json';
import shared from './nl/shared.json'; import common from './nl/common.json';
import site from './nl/site.json';
/** /**
* Static website texts (Dutch). One JSON file per area; keys are typed so a missing or misspelled key * Static website texts (Dutch). One JSON file per area; keys are typed so a missing or misspelled key
@@ -8,7 +9,7 @@ import shared from './nl/shared.json';
* already comes from the CMS (packages, banners). A second language later = a second folder with the * already comes from the CMS (packages, banners). A second language later = a second folder with the
* same keys plus a language switch here; no component needs to change. * same keys plus a language switch here; no component needs to change.
*/ */
export const nl = { landing, era, shared } as const; export const nl = { common, site, home, era } as const;
type Leaves<T, P extends string = ''> = { type Leaves<T, P extends string = ''> = {
[K in keyof T & string]: T[K] extends string [K in keyof T & string]: T[K] extends string
@@ -1,20 +1,22 @@
{ {
"aria": {
"skipLink": "Naar de inhoud", "skipLink": "Naar de inhoud",
"errorBoundary": "Er ging iets mis. Probeer de pagina te vernieuwen.",
"toggles": {
"darkMode": "Donkere weergave", "darkMode": "Donkere weergave",
"variantToTimeTravel": "Tijdreis: bekijk de site zoals vroeger", "variantToTimeTravel": "Tijdreis: bekijk de site zoals vroeger",
"variantBack": "Terug naar nu" "variantBack": "Terug naar nu"
}, },
"variantAlert": { "status": {
"toE": "Tijdreis-weergave geladen.",
"toB": "Terug naar de moderne weergave.",
"failed": "De tijdreis kon niet worden geladen."
},
"error": {
"boundary": "Er ging iets mis. Probeer de pagina te vernieuwen."
},
"alert": {
"message": "De tijdreis kon niet worden geladen.", "message": "De tijdreis kon niet worden geladen.",
"retry": "Opnieuw proberen", "retry": "Opnieuw proberen",
"dismissLabel": "Melding sluiten", "dismissLabel": "Melding sluiten",
"dismiss": "Sluiten" "dismiss": "Sluiten"
},
"announce": {
"toE": "Tijdreis-weergave geladen.",
"toB": "Terug naar de moderne weergave.",
"failed": "De tijdreis kon niet worden geladen."
} }
} }
@@ -1,13 +1,4 @@
{ {
"nav": {
"label": "Hoofdnavigatie",
"about": "Over",
"packages": "Pakketten",
"process": "Werkwijze",
"cta": "Start project",
"menuClose": "Sluit menu",
"menuOpen": "Open menu"
},
"about": { "about": {
"photoAlt": "Bryan Slop, oprichter van SLP Software", "photoAlt": "Bryan Slop, oprichter van SLP Software",
"heading": "Eén ontwikkelaar, korte lijnen", "heading": "Eén ontwikkelaar, korte lijnen",
@@ -16,9 +7,18 @@
"Van een strakke landingspagina tot een applicatie met eigen contentmanagementsysteem — de aanpak is hetzelfde: heldere afspraken, nette code en een resultaat waar je jaren mee vooruit kunt." "Van een strakke landingspagina tot een applicatie met eigen contentmanagementsysteem — de aanpak is hetzelfde: heldere afspraken, nette code en een resultaat waar je jaren mee vooruit kunt."
], ],
"facts": { "facts": {
"contact": { "title": "Direct contact", "text": "met de ontwikkelaar zelf" }, "contact": {
"response": { "title": "Eén werkdag", "text": "tot je een reactie hebt" }, "title": "Direct contact",
"price": { "title": "Vaste prijs", "text": "per pakket, vooraf bekend" } "text": "met de ontwikkelaar zelf"
},
"response": {
"title": "Eén werkdag",
"text": "tot je een reactie hebt"
},
"price": {
"title": "Vaste prijs",
"text": "per pakket, vooraf bekend"
}
} }
}, },
"process": { "process": {
@@ -88,9 +88,6 @@
"privacyNote": "Je gegevens gebruik ik alleen om op je bericht te reageren; ik bewaar ze maximaal 1 jaar." "privacyNote": "Je gegevens gebruik ik alleen om op je bericht te reageren; ik bewaar ze maximaal 1 jaar."
} }
}, },
"footer": {
"copyright": "© 2026 SLP Software"
},
"static": { "static": {
"packagesHeading": "Manieren om te starten." "packagesHeading": "Manieren om te starten."
} }
+14
View File
@@ -0,0 +1,14 @@
{
"nav": {
"label": "Hoofdnavigatie",
"about": "Over",
"packages": "Pakketten",
"process": "Werkwijze",
"cta": "Start project",
"menuClose": "Sluit menu",
"menuOpen": "Open menu"
},
"footer": {
"copyright": "© 2026 SLP Software"
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ export function StaticLanding() {
id="pakketten-heading" id="pakketten-heading"
className="max-w-[12ch] text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%]" className="max-w-[12ch] text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%]"
> >
{t('landing.static.packagesHeading')} {t('home.static.packagesHeading')}
</h2> </h2>
</div> </div>
</section> </section>
+3 -3
View File
@@ -46,7 +46,7 @@ export function deriveChips(cards: PackageCardData[], threshold: number): Chip[]
return null; return null;
} }
return [ return [
{ id: ALL_CHIP, label: t('landing.packages.filterAll'), count: cards.length }, { id: ALL_CHIP, label: t('home.packages.filterAll'), count: cards.length },
...[...counts].map(([name, count]) => ({ id: `cat:${name}`, label: name, count })), ...[...counts].map(([name, count]) => ({ id: `cat:${name}`, label: name, count })),
]; ];
} }
@@ -60,10 +60,10 @@ export function filterCards(cards: PackageCardData[], activeId: string): Package
/** BR-U3-4 */ /** BR-U3-4 */
export function resultLabel(count: number, hasBanner: boolean): string { export function resultLabel(count: number, hasBanner: boolean): string {
const result = t(count === 1 ? 'landing.packages.resultOne' : 'landing.packages.resultMany', { const result = t(count === 1 ? 'home.packages.resultOne' : 'home.packages.resultMany', {
count, count,
}); });
return hasBanner ? t('landing.packages.resultWithBanner', { result }) : result; return hasBanner ? t('home.packages.resultWithBanner', { result }) : result;
} }
/** BR-U3-7: index of the featured card, else the first one. */ /** BR-U3-7: index of the featured card, else the first one. */
+4 -4
View File
@@ -79,8 +79,8 @@ function removeLegacyThemeKey(): void {
} }
} }
const ANNOUNCE_TO_E = t('shared.announce.toE'); const ANNOUNCE_TO_E = t('common.status.toE');
const ANNOUNCE_TO_B = t('shared.announce.toB'); const ANNOUNCE_TO_B = t('common.status.toB');
function wait(ms: number): Promise<void> { function wait(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms)); return new Promise((resolve) => setTimeout(resolve, ms));
@@ -174,7 +174,7 @@ export function ThemeProvider({ children, loadVariant }: ThemeProviderProps) {
// BR-U1-8: stay in the current variant and tell the visitor. // BR-U1-8: stay in the current variant and tell the visitor.
if (mountedRef.current) { if (mountedRef.current) {
setVariantError(true); setVariantError(true);
setAnnouncement(t('shared.announce.failed')); setAnnouncement(t('common.status.failed'));
} }
} finally { } finally {
busyRef.current = false; busyRef.current = false;
@@ -199,7 +199,7 @@ export function ThemeProvider({ children, loadVariant }: ThemeProviderProps) {
const reportVariantError = useCallback(() => { const reportVariantError = useCallback(() => {
setVariant(DEFAULT_VARIANT); setVariant(DEFAULT_VARIANT);
setVariantError(true); setVariantError(true);
setAnnouncement(t('shared.announce.failed')); setAnnouncement(t('common.status.failed'));
setTransition({ phase: 'idle', target: null }); setTransition({ phase: 'idle', target: null });
}, []); }, []);