From d1e02d1f1cce504da39a0dff15b8bb68c0f6ce09 Mon Sep 17 00:00:00 2001 From: Sluijsens Date: Sun, 15 Nov 2026 20:51:27 +0100 Subject: [PATCH] Translation files: describe what is in which file and the rules Co-Authored-By: Claude Sonnet 5.5 --- docs/translations.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/translations.md b/docs/translations.md index 49d2457..e05bc55 100644 --- a/docs/translations.md +++ b/docs/translations.md @@ -28,6 +28,28 @@ Dotted paths: the file name, then the page or section, then the element: `home.p - A test checks that every language has the same keys and `{parameters}` as Dutch, and that no text is empty or says TODO. - ESLint (`react/jsx-no-literals`) warns about a text typed straight into JSX, so a new hardcoded text is noticed in review and in CI. +## What is in which file + +| File | Texts | +| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `common.json` | shared labels: `aria`, `site.name`, `newTab`, `actions` (general button words), `form` (labels, placeholders, captcha message), `status` (404 and error page), `lightbox`, `gate`, `privacyNote`, `pricing` labels | +| `site.json` | `nav`, `footer`, `breadcrumb`, `info` (service area, reply time, mail subjects), `socials` | +| `home.json` | the home page sections and the booking labels (`booking.book`, `booking.readMore`) | +| `about.json`, `contact.json` | the about page and the contact page | +| `shoots.json` | the overview, every shoot type and every shoot page (`pages.`), shared shoot texts | +| `portfolio.json`, `instagram.json`, `testimonials.json` | those pages and sections, with their photo alt texts and reviews | +| `seo.json` | page titles, descriptions and link-preview alt texts per page (`seo.pages.`) | + +Not here: the hero, the privacy statement, everything from the CMS, and the form validation messages of the copied `src/cms-client` package (`messages.nl.ts`). + +## Importing the language files + +Components import from `@/i18n`. Files that Node loads while building (everything reached from `src/seo.ts`, `src/sitePages.ts`, the content modules, `src/lib`, `src/navigation.ts`) cannot use the `@/` alias or a directory import, so they use `../i18n/index.ts` (relative, with the extension). The JSON files are imported with `with { type: 'json' }` for the same reason. + +## Rules that are enforced + +`react/jsx-no-literals` and a rule for text attributes (`aria-label`, `alt`, `title`, `placeholder`, `label`) are errors in components and routes (the hero, tests and the privacy page are left out; an empty `alt=""` for a decorative image is fine). A new text goes into the language file first. + ## Adding a language (later) 1. Copy `web/src/i18n/nl` to `web/src/i18n/` and translate the values (keys and `{parameters}` stay).