mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
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.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
/**
|
|
* Country names in the app languages, for the source lines of the life
|
|
* circumstances (screening hints, AUDIT-C cut-offs): a rule always says whose
|
|
* rule it is, in the language of the account reading it.
|
|
*
|
|
* Client-safe, no imports.
|
|
*/
|
|
export type SourceCountry = "DE" | "KR" | "US";
|
|
|
|
const NAMES: Readonly<Record<string, Readonly<Record<SourceCountry, string>>>> =
|
|
{
|
|
de: { DE: "Deutschland", KR: "Südkorea", US: "USA" },
|
|
en: { DE: "Germany", KR: "South Korea", US: "United States" },
|
|
es: { DE: "Alemania", KR: "Corea del Sur", US: "Estados Unidos" },
|
|
fr: { DE: "Allemagne", KR: "Corée du Sud", US: "États-Unis" },
|
|
it: { DE: "Germania", KR: "Corea del Sud", US: "Stati Uniti" },
|
|
pl: { DE: "Niemcy", KR: "Korea Południowa", US: "Stany Zjednoczone" },
|
|
nl: { DE: "Duitsland", KR: "Zuid-Korea", US: "Verenigde Staten" },
|
|
ko: { DE: "독일", KR: "대한민국", US: "미국" },
|
|
"pt-BR": { DE: "Alemanha", KR: "Coreia do Sul", US: "Estados Unidos" },
|
|
};
|
|
|
|
export function countryLabel(
|
|
country: SourceCountry,
|
|
locale: string | null | undefined,
|
|
): string {
|
|
return (NAMES[locale ?? "en"] ?? NAMES.en)[country];
|
|
}
|