emrg: gui renderer Batch 1 remainder — i18n full dictionary (373 keys) + markdown port - #993
Merged
Merged
Conversation
…) + markdown port - i18n-dicts.ts: full zh/en dictionary auto-generated from vanilla i18n.js (373 keys, strict zh/en parity guard test) - i18n.tsx: vanilla detectLocale/getLocale/setLocale/t logic ported; zh-fallback + localStorage 'emrg.locale' override; React shell keys kept as provider-level extension (vanilla dict stays pure) - markdown.ts: marked/DOMPurify/hljs injectable wrapper (renderMarkdown, block-projection streamProject/streamFinalize, fence-closed heuristic) - vitest: +11 i18n (mirrors old node:test assertions + parity guard), +11 markdown (dual-state fence, escaping, hljs, streaming) → 56 total - Agent.md: renderer 34→56 vitest, Batch 1 remainder documented
argszero
commented
Aug 26, 2026
argszero
left a comment
OwnerAuthor
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260826-140537 (1/3)
Verified this cycle:
- Head 507977a unchanged since submission; PR MERGEABLE
- CI green: test + test-windows pass (run 32936239914)
- Diff review: 6 files / +1324 — i18n-dicts.ts full 373-key zh/en dict (mechanical generation, parity-guarded), i18n.tsx vanilla locale-logic port (detectLocale/getLocale/setLocale/t with zh fallback), markdown.ts injectable marked/DOMPurify/hljs wrapper with block-projection streaming, +22 vitest (i18n 11 + markdown 11)
- Agent.md count sync (renderer vitest 34→56)
Batch 1 remainder ready for merge once 3 consecutive LGTMs accumulate.
argszero
commented
Aug 26, 2026
argszero
left a comment
OwnerAuthor
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260826-141311 (2/3)
Re-verified this cycle:
- Head 507977a unchanged since submission; PR MERGEABLE / CLEAN
- CI still green: test + test-windows pass (run 32936239914)
- Diff unchanged (6 files / +1324); i18n full-dict + markdown port remain sound
Consecutive LGTMs so far: cyc20260826-140537 (1/3) → this cycle (2/3).
argszero
commented
Aug 26, 2026
argszero
left a comment
OwnerAuthor
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260826-141945 (3/3)
Re-verified this cycle:
- Head 507977a unchanged; mergeStateStatus CLEAN / MERGEABLE
- CI still green: test + test-windows pass (run 32936239914)
- Diff unchanged (6 files / +1324)
3 consecutive LGTMs from different cycles (140537 → 141311 → 141945), no ❌ in between. Merge condition satisfied.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Batch 1 remainder of the GUI renderer React migration (design
~/.emrg/designs/gui-react-migration-design.md§5, rant 2026-08-26T12:16:48 — Batch 1 items 3 + 5). Completes the pure-logic port layer after #992 (commands/copywriting + preload API-surface guard).1. i18n — full dictionary + vanilla logic port
src/lib/i18n-dicts.ts(auto-generated from vanillarenderer/js/i18n.js): full 373-key zh/en dictionaries, strict parity (guarded by test).src/lib/i18n.tsxupgraded from Batch-0 skeleton to the full implementation:detectLocale()(navigator, zh* → zh),getLocale()/setLocale()(localStorageemrg.localeoverride, "" = follow system),t(key, params)with zh fallback +{var}interpolation — semantics identical to vanilla.shell.batch0Noticeetc.) kept as a provider-level extension so the vanilla dict stays pure.i18n.test.ts): mirror the oldemrg/gui/test/i18n.test.jsnode:test assertions (detectLocale / en-zh strings / setLocale persistence / interpolation / unknown-key) + dictionary parity guard (373 keys aligned, no drift).2. markdown — port with injectable vendor deps
src/lib/markdown.ts:createMarkdownRenderer({ marked, DOMPurify, hljs, t })returnsrenderMarkdown/streamProject/streamFinalize— ports the vanilla marked-v12 code renderer (hljs exact-lang highlight, auto fallback), DOMPurify sanitize, the block-projection streaming logic (stable blocks cached, live tail block re-rendered, unclosed fence → plain text,FENCE_END_RE/isFenceClosedexported pure).window— testable in Vitest, wired to the browser entry when Batch 2 (chat) lands.markdown.test.ts): fence open/closed dual-state, no-marked escape fallback, fake-marked render + DOMPurify sanitize, hljs highlight path, copy-button i18n, block-projection DOM structure (jsdom).Verification (all green)
npm run typecheckclean;npm test56/56 (was 34; +11 i18n +11 markdown)npm test265 (257 pass + 8 skipped, 0 fail)Vanilla files (
js/i18n.js,js/markdown.js) stay untouched until Batch 5 switch (design D3).