Phase 19: the copy stops being hardcoded Mandarin

Every `中文 · English` string moves out of ~29 components into
web/src/i18n: one Pack type, a verbatim zh pack, and two ways to read
it — usePack() for components, pack() for the modules that build a line
when something happens rather than when something renders.

Anything with a value in it is a function on the pack rather than a
template at the call site, English pluralisation included: word order
isn't universal, and a pack author has to be able to move the number.
The roster constants (tones, rewrite styles, export formats, companions)
keep only value + emoji, so a label can't drift from its key.

On the server, internal/llm/lang.go replaces "Simplified Chinese" in the
three prompts that actually name her language. pt-PT is spelled
"European Portuguese (pt-PT, never Brazilian Portuguese)" in the prompt
itself, and each Lang carries her word for "why" so the tutor prompt
still recognises the question when she asks it her way.

pair_lang reaches the model through the row-scoped query each handler
already ran — the one that proves she owns the document — rather than a
second lookup that could disagree with it.

Also records Phase 18's deploy: migration 0011 rehearsed against a copy
of the live VPS database, then applied for real.
This commit is contained in:
prosolis
2026-07-27 08:37:05 -07:00
parent 30d5e691c9
commit 336cae93e0
45 changed files with 1331 additions and 371 deletions
+8 -9
View File
@@ -6,6 +6,8 @@
// again as an errand, not an error. The editor stays visible behind the scrim
// (dimmed, still there) for the same reason: nothing has been taken away.
import { usePack } from '../../i18n'
interface Props {
// Whether there is unsaved writing waiting on this device, which changes the
// reassurance from a promise to a statement of fact.
@@ -13,6 +15,7 @@ interface Props {
}
export function SignInOverlay({ hasDraft }: Props) {
const t = usePack()
return (
<div
role="dialog"
@@ -39,21 +42,17 @@ export function SignInOverlay({ hasDraft }: Props) {
className="mt-3 text-lg font-bold"
style={{ color: 'var(--color-plum)' }}
>
{t.auth.title}
</h2>
<p className="text-sm font-semibold" style={{ color: 'var(--color-muted)' }}>
Please sign in again
{t.auth.titleEn}
</p>
<p className="mt-4 text-sm leading-relaxed" style={{ color: 'var(--color-plum)' }}>
{hasDraft
? '你刚写的内容已经安全地留在这台电脑上,登录后会自动接着保存。'
: '登录状态过期了。你的文字都已经保存好了。'}
{hasDraft ? t.auth.bodyWithDraft : t.auth.bodyPlain}
</p>
<p className="mt-1 text-xs leading-relaxed" style={{ color: 'var(--color-muted)' }}>
{hasDraft
? "What you just wrote is safe on this device — it'll save itself once you're back in."
: 'Your session expired. Everything you wrote is already saved.'}
{hasDraft ? t.auth.bodyWithDraftEn : t.auth.bodyPlainEn}
</p>
<a
@@ -63,7 +62,7 @@ export function SignInOverlay({ hasDraft }: Props) {
onMouseEnter={(e) => (e.currentTarget.style.background = 'var(--color-accent-hover)')}
onMouseLeave={(e) => (e.currentTarget.style.background = 'var(--color-accent)')}
>
· Sign in
{t.auth.signIn}
</a>
</div>
</div>