Implement create custom recommendations
This commit is contained in:
@@ -39,9 +39,16 @@ file are a smell once they're used more than once.
|
||||
|
||||
## Copy & data
|
||||
|
||||
- Step copy lives in `messages/en/create/<step>.json`, wired into
|
||||
`messages/en/index.ts` under the `create:` namespace (see
|
||||
`localization.mdc` for the standard pattern).
|
||||
- Step copy lives in `messages/en/create/<stage>/<step>.json` where
|
||||
`<stage>` is one of `community`, `customRule`, `reviewAndComplete`
|
||||
(matches Figma stages — see `docs/create-flow.md`). Cross-cutting chrome
|
||||
(`footer.json`, `topNav.json`, `draftHydration.json`,
|
||||
`templateReview.json`) and shared layout-shell strings (`select.json`,
|
||||
`text.json`, `upload.json`) live at the `create/` root. Wire each new
|
||||
JSON into `messages/en/index.ts` under the matching `create.<stage>.*`
|
||||
namespace (see `localization.mdc`).
|
||||
- Modal `sections` defaults are DB-shaped seed placeholders, not UI
|
||||
constants — expect replacement with live data.
|
||||
- Modal `sections` defaults are DB-shaped seed placeholders, not UI
|
||||
constants — expect replacement with live data.
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@ notation). Never hard-code user-facing strings in components.
|
||||
- `messages/en/<area>.json` for single-file areas (`common.json`,
|
||||
`navigation.json`, `metadata.json`).
|
||||
- `messages/en/<folder>/<entry>.json` for areas with multiple buckets:
|
||||
`components/*.json`, `pages/*.json`, `create/*.json`. One JSON per
|
||||
component / page / create-flow step — don't shoehorn unrelated copy into
|
||||
a shared file.
|
||||
`components/*.json`, `pages/*.json`. One JSON per component / page —
|
||||
don't shoehorn unrelated copy into a shared file.
|
||||
- `messages/en/create/<stage>/<step>.json` — wizard steps grouped by Figma
|
||||
stage (`community`, `customRule`, `reviewAndComplete`). Cross-cutting
|
||||
chrome (footer, top nav, draft hydration, template review) and shared
|
||||
layout-shell strings (`select.json`, `text.json`, `upload.json`) live at
|
||||
the `create/` root.
|
||||
- Optional `"_comment"` at the top of a JSON documents the bundle's purpose.
|
||||
|
||||
## Registration — required
|
||||
@@ -25,12 +29,14 @@ notation). Never hard-code user-facing strings in components.
|
||||
Every new JSON must be wired into `messages/en/index.ts`:
|
||||
|
||||
```typescript
|
||||
import createConflictManagement from "./create/conflictManagement.json";
|
||||
import createConflictManagement from "./create/customRule/conflictManagement.json";
|
||||
|
||||
export default {
|
||||
// …
|
||||
create: {
|
||||
conflictManagement: createConflictManagement,
|
||||
customRule: {
|
||||
conflictManagement: createConflictManagement,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
@@ -44,7 +50,7 @@ step means consumers can't read your strings and TypeScript won't flag the gap.
|
||||
import { useMessages } from "../contexts/MessagesContext";
|
||||
|
||||
const m = useMessages();
|
||||
const title = m.create.conflictManagement.page.compactTitle; // fully typed
|
||||
const title = m.create.customRule.conflictManagement.page.compactTitle; // fully typed
|
||||
```
|
||||
|
||||
Use `useTranslation(namespace)` only when you need dot-path lookup by dynamic
|
||||
|
||||
Reference in New Issue
Block a user