Implement create custom recommendations
This commit is contained in:
@@ -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