Translation files: area files in place and the common texts for shared labels
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,12 @@ Not in the language files: the hero (becomes a CMS module), the privacy statemen
|
||||
|
||||
Dotted paths: the file name, then the page or section, then the element: `home.pricing.title`, `shoots.newborn.faq.0.question`, `common.aria.backToTop`, `common.form.errors.required`, `seo.pages.contact.title`. A list is an array in the JSON and keeps the order of the page; a position is a number in the path. Parameters are written `{name}`; a text with a plural has the forms `one` and `other` (`photos.one`, `photos.other`) and `{count}` is filled in by `tPlural`. No HTML in the texts: a text with a link or emphasis is a structured list of parts, as the content modules already have.
|
||||
|
||||
## Two ways to read a text
|
||||
|
||||
- A single text in a component: `t('home.pricing.title')`, or `tList(...)` for a list of plain texts, `tPlural(...)` for singular and plural.
|
||||
- Structured content (a list of items with several texts, such as the questions and answers of a page): the content module reads the typed tree directly, `messages.shoots.newborn.faq.map((item) => ({ question: item.question, answer: item.answer }))`. A missing property breaks `tsc`, the same as a missing key. The content modules in `web/src/content` keep their types, images and paths and take the words from `messages`.
|
||||
- `t()` is not given keys that are built at run time (`` `faq.${i}.question` ``): use the tree for lists.
|
||||
|
||||
## How a missing text is found
|
||||
|
||||
- `t('...')` only accepts keys that exist in the Dutch files; a typo or a missing key stops `tsc` and the build.
|
||||
|
||||
Reference in New Issue
Block a user