feat(i18n): register Brazilian Portuguese as a locale

Add pt-BR to the locale list and everything that hangs off it: the
client loader, Intl and date-fns mapping, the reply-language footers of
the Coach and insights prompts (English body, pt-BR footer, the same
path Korean and Dutch take), the citation-coverage normative words, the
no-key fallback copy, the AUDIT-C standard-drink line, country labels,
period search, CSV yes/no cells and the Telegram bare-word aliases.

The locale enums in the extract, managed-profile and record-settings
schemas now derive from the locale list instead of repeating it, and
the five notification and login-alert routes share one isLocale guard
instead of hand-rolled chains, so a later locale is one edit there.
A language tag is matched exactly and case-insensitively before its
primary subtag, so pt-BR and pt-PT browsers land on the Portuguese
bundle rather than English, and AUDIT-C no longer cuts a region tag to
two letters.

PHQ-9, GAD-7 and WHO-5 are not marked validated for pt-BR: the wording
has not been read against the published Brazilian forms, so readers get
the English items plus the existing note.
This commit is contained in:
Marc-André Bombeck committed 2026-10-22 14:50:00 +02:00
1 parent 1619b2406a
commit 764794496c
72 files changed
+425 -159

No files matched your search

@@ -24,6 +24,7 @@ import {
} from "@/lib/medication-list-layout";
import { MEDICATION_IMPORT_SKIP_REASONS } from "@/lib/jobs/medication-intake-import";
import { isoDateTime } from "@/lib/validations/datetime";
import { locales } from "@/lib/i18n/config";
// ── Medications (v1.5 scheduling) ────────────────────────────────────
//
@@ -1124,7 +1125,7 @@ export const medicationExtractRequest = z
"Free-text medication description (any locale). Up to 2 000 characters. The model never echoes the text back into another tenant — it is only used to produce the structured fields.",
),
locale: z
.enum(["en", "de", "es", "fr", "it", "pl", "ko", "nl"])
.enum(locales)
.optional()
.describe("Optional UI locale hint for the model."),
today: z
+2 -1
View File
@@ -34,6 +34,7 @@ import {
stdResponses,
} from "./shared";
import { isoDateTime } from "@/lib/validations/datetime";
import { locales } from "@/lib/i18n/config";
const thresholdMetricEnum = z
.enum(Object.keys(METRIC_BOUNDS) as [string, ...string[]])
@@ -127,7 +128,7 @@ const profileSettings = z
.nullable()
.describe("Calendar date (`YYYY-MM-DD`), not an instant."),
gender: z.enum(["MALE", "FEMALE", "OTHER"]).nullable(),
locale: z.enum(["de", "en", "es", "fr", "it", "pl", "ko", "nl"]).nullable(),
locale: z.enum(locales).nullable(),
timezone: z.string(),
unitPreference: z
.enum(["metric", "imperial"])