fix(walkthrough): offer German, and catch the next locale that is only half added

German was added to the interface but not to the walkthrough's own language
list, and nothing failed: the picker offered Deutsch because it is built from
the interface locales, the server resolved the tag to English, and a German
reader paid for a walkthrough written in English while the picker still said
Deutsch.

The two lists cannot be one — the server cannot import from packages/ui — so
a test reads i18n/runtime.ts and compares them, in both directions and through
normalizeLanguage. Drift this quiet needs a test rather than vigilance.
This commit is contained in:
Bohdan Triapitsyn
2026-08-03 13:55:51 +03:00
parent 2dca614849
commit ce09ca6190
3 changed files with 68 additions and 1 deletions
@@ -136,7 +136,12 @@ silently. The prompt says so explicitly.
`languages.js` owns the accepted tags; they match the UI's `Locale` union, and
anything else — unknown, malformed, absent — resolves to English rather than
failing the request. The default language adds no instruction at all, since the
failing the request. The two lists cannot be one, because the server cannot
import from `packages/ui`, so `languages.test.js` reads `i18n/runtime.ts` and
compares them. That test exists because a locale added to the interface alone
fails silently in the worst way: the picker offers the language, the tag
resolves to English, and the reader pays for a walkthrough written in the wrong
one while the picker still names theirs. The default language adds no instruction at all, since the
system prompt is already English.
The language is part of the cache key. Without that, asking for a translation