docs
This commit is contained in:
@@ -25,7 +25,7 @@ They exist to avoid duplicating presentation logic across View Models.
|
||||
A Display Object MAY:
|
||||
|
||||
- format values (money, dates, durations)
|
||||
- handle localization and language-specific rules
|
||||
- handle localization only when localization inputs are deterministic (for example: mapping stable codes to stable labels)
|
||||
- map codes to labels
|
||||
- encapsulate UI display conventions
|
||||
- be reused across multiple View Models
|
||||
@@ -67,6 +67,20 @@ In this repository, a Display Object MUST NOT:
|
||||
|
||||
Reason: these are runtime-locale/timezone dependent and cause SSR/hydration mismatches.
|
||||
|
||||
## Localization rule (strict)
|
||||
|
||||
Localization MUST NOT depend on runtime locale APIs.
|
||||
|
||||
Allowed approaches:
|
||||
|
||||
- API returns the exact labels/strings for the current user context.
|
||||
- Website maps stable codes to stable labels using a deterministic table.
|
||||
|
||||
Forbidden approaches:
|
||||
|
||||
- any usage of `Intl.*`
|
||||
- any usage of `toLocale*`
|
||||
|
||||
If a rule affects system correctness or persistence,
|
||||
it does not belong in a Display Object.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user