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
@@ -17,6 +17,7 @@ export const DEFAULT_LANGUAGE = 'en';
// which every model handles more reliably than a switch mid-sentence.
const LANGUAGE_NAMES = {
en: 'English',
de: 'German',
fr: 'French',
'zh-CN': 'Simplified Chinese',
'zh-TW': 'Traditional Chinese',
@@ -57,3 +58,9 @@ export function normalizeLanguage(value) {
export function languageName(language) {
return LANGUAGE_NAMES[language] ?? LANGUAGE_NAMES[DEFAULT_LANGUAGE];
}
// The tags this list must agree with live in `packages/ui/src/lib/i18n`, which
// the server cannot import. `languages.test.js` compares the two by reading
// that file, because a locale added on one side only fails silently: the picker
// offers the language and the walkthrough comes back in English.
export const __testing = { LANGUAGE_NAMES };