Translation files: the form messages of the cms-client package come from nl.json
Block cmsClient.contact holds the field errors, fallback, waiting time (one and other), too-large, captcha-required, failure and sending label. src/i18n/cmsClientMessages.ts builds the ContactMessages object for useContactForm; a test checks that it says the same as the package's own Dutch defaults, which stay as the fallback. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ The texts of the site live in language files, not in the components. Dutch is th
|
||||
|
||||
## Where things are
|
||||
|
||||
- `web/src/i18n/nl.json`: all Dutch texts of the site in one file, in blocks per area in the order of the site: `common`, `site`, `home`, `about`, `contact`, `shoots`, `portfolio`, `instagram`, `testimonials`, `seo`. The file is the source of the types. A second language is `web/src/i18n/en.json` with the same keys.
|
||||
- `web/src/i18n/nl.json`: all Dutch texts of the site in one file, in blocks per area in the order of the site: `common`, `site`, `home`, `about`, `contact`, `shoots`, `portfolio`, `instagram`, `testimonials`, `seo`, `cmsClient`. The file is the source of the types. A second language is `web/src/i18n/en.json` with the same keys.
|
||||
- `web/src/i18n/index.ts`: `t(key, params?)` for a text, `tList(key)` for a list of texts, `tPlural(key, count, params?)` for a text with a singular and a plural form, `locales`, `locale` and `Messages`.
|
||||
- `web/src/i18n/compare.ts`: the checks the tests use (same keys and parameters, nothing empty).
|
||||
- The typed content modules in `web/src/content` keep their structure, images and paths; the words come from the language files.
|
||||
@@ -40,7 +40,9 @@ Dotted paths: the block (`common`, `home`, ...), then the page or section, then
|
||||
| `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.<page>`) |
|
||||
|
||||
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`).
|
||||
The block `cmsClient` holds the texts of the shared `src/cms-client` package, per part of the package: `cmsClient.contact` has the form's field errors, fallback, waiting time (`rateLimited.one/other` with `{minutes}`), too-large, captcha-required, failure (`{address}`) and the sending label. `src/i18n/cmsClientMessages.ts` builds the `ContactMessages` object from it and `ContactForm` passes it to `useContactForm({ messages })`. The package keeps its own Dutch defaults (`messages.nl.ts`) as a fallback and a test checks that both say the same. Parts that come later (offerings) get their own part of the block.
|
||||
|
||||
Not here: the hero, the privacy statement and everything from the CMS.
|
||||
|
||||
## Importing the language files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user