fix(presentation): persist the chosen locale in preferences (R-8.3)

The locale lived only in LocaleProvider state, so every remount (reload,
or the scope fence after a session change) started again from ko-KR.
The theme already persisted through preferences.setColorScheme; the
locale now uses the same path (D-5):

- contracts/storage-keys.ts: LOCALE key next to COLOR_SCHEME
  (localStorage, public-preference, opaque-string-v1).
- application preferences port: additive getLocale()/setLocale(). The
  application treats the tag as opaque; presentation owns the locale
  list and normalizes what it reads back.
- LocaleProvider: optional onLocaleChange; the provider stays
  storage-free so standalone uses and tests are unchanged.
- AppRouter mounts LocaleProvider from the stored locale and persists
  changes (T46 moves this above the scope fence).

Verified: RED "stores the chosen locale and starts the next mount from
it" failed before (nothing written to LOCALE) and passes after.
check:architecture, check:types:app, check:types:test, lint,
test:component pass; check:registries PASS (compatibility unchanged from
baseline); test:unit passes except the pre-existing removal-fixture test
(needs generated artifacts/ files absent from a fresh worktree).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-24 12:39:51 +09:00
co-authored by Claude Opus 5.5
parent b1a8269d65
commit e5ef6ba236
6 changed files with 79 additions and 4 deletions
+13
View File
@@ -45,6 +45,19 @@ export const STORAGE_REGISTRY = Object.freeze({
migration: "discard",
quotaFallback: "memory",
}),
/** The chosen UI locale. Presentation normalizes whatever it reads back. */
LOCALE: defineStorageKey({
logicalName: "LOCALE",
scope: "preference",
name: "locale",
backend: "localStorage",
classification: "public-preference",
schemaVersion: 1,
valueCodec: "opaque-string-v1",
ttl: null,
migration: "discard",
quotaFallback: "memory",
}),
CHUNK_RELOAD_GUARD: defineStorageKey({
logicalName: "CHUNK_RELOAD_GUARD",
scope: "release",