mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
Every background path that resolved a user row's locale collapsed a NULL column to English: the nightly briefing warm, the status crons, the period-narrative warm, reaction lines, the morning refresh, the briefing push, coach nudges, the reminder workers, and the document and workout summaries each carried their own copy of `locales.includes(x) ? x : defaultLocale` or called `normalizeLocale(user.locale)`. None consulted the instance's configured default language, so an account that never touched the language picker got English prose and English pushes on a German-language instance. Add resolveJobLocale (src/lib/i18n/job-locale.ts): stored user locale when valid, else the operator's app_settings.default_locale when valid, else English. The settings read lives beside the other app-settings accessors. Every job and daily path resolves through it once, where it has the row; the template helpers keep coerceLocale for a value that is already resolved, and queue payloads keep normalizeLocale. The briefing push hands its resolved locale down to the digest, and the digest to the snapshot read, so the push copy and the digest lines are in the same language instead of two different fallbacks. A structural test walks src/lib/jobs and src/lib/daily and fails on a hand-rolled coercion, a validator applied to a row column, or a row reader that does not import the helper. It was red against the previous tree on all three counts.