mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 08:02:12 +00:00
Full Russian catalog (11,154 keys, 1:1 with en, identical nesting) and every
locale wiring point the app declares, so ru is a first-class locale instead
of an English fallback:
- messages/ru.json, project.inlang/settings.json, i18n boot script
- i18n config / load-locale, format-locale (ru-RU), date-fns ru
- labs: parse-reference-range RANGE_PROSE for Russian lab sheets
("3,5 - 5,0", "от 3,5 до 5,0", "до 5,6", "не более 5,6")
- AI: citation-coverage normative stems, coach system prompt and insights
reply footer (Russian prompts must override the hard-coded
"Respond in English"), population-norm patterns
- safety: outbound-screen Russian imperative/dose/unit/causality bank
- mental health: PHQ-9, GAD-7, WHO-5 and SCI wording
verify-message-catalogs.mjs passes for all 10 locales.
52 lines
2.3 KiB
TypeScript
52 lines
2.3 KiB
TypeScript
/**
|
|
* Bare-word aliases the Telegram bot answers, per app language.
|
|
*
|
|
* The bot's real commands are slash commands (`/help`, `/start`, `/add`) plus
|
|
* the `taken <name>` text command, and `telegram.helpBody` documents exactly
|
|
* those in every bundle; none of that depends on the reader's language. What
|
|
* did depend on it were the two undocumented courtesies below, which knew
|
|
* English and German: "aide", "ayuda", "aiuto" and "pomoc" reached the intake
|
|
* keyword instead, failed it, and the handler returned without replying at all.
|
|
* Silence is the worst answer to someone asking for help.
|
|
*
|
|
* These are ordinary words, not app labels, so there is nothing in the bundles
|
|
* to derive them from. One entry per locale, so a new language cannot be
|
|
* forgotten here. The bot matches the union, whatever the reader's language,
|
|
* on the FOLDED text, so "cześć" and "czesc" are one entry and a stray capital
|
|
* or accent cannot miss.
|
|
*/
|
|
import type { Locale } from "@/lib/i18n/config";
|
|
|
|
interface BareWords {
|
|
/** "Help". */
|
|
readonly help: readonly string[];
|
|
/** Greetings the bot answers with a wave. */
|
|
readonly greeting: readonly string[];
|
|
}
|
|
|
|
const BARE_WORDS: Readonly<Record<Locale, BareWords>> = {
|
|
en: { help: ["help"], greeting: ["hi", "hello", "hey"] },
|
|
de: { help: ["hilfe"], greeting: ["hallo", "moin"] },
|
|
fr: { help: ["aide"], greeting: ["bonjour", "salut"] },
|
|
es: { help: ["ayuda"], greeting: ["hola", "buenas"] },
|
|
it: { help: ["aiuto"], greeting: ["ciao", "salve"] },
|
|
pl: { help: ["pomoc"], greeting: ["czesc", "witaj", "dzien dobry"] },
|
|
ko: { help: ["도움말", "도움"], greeting: ["안녕", "안녕하세요"] },
|
|
nl: { help: ["hulp"], greeting: ["hoi", "hallo", "goedemorgen"] },
|
|
"pt-BR": { help: ["ajuda"], greeting: ["oi", "ola", "bom dia"] },
|
|
ru: {
|
|
help: ["помощь", "помоги", "помогите"],
|
|
greeting: ["привет", "здравствуй", "здравствуйте", "добрый день"],
|
|
},
|
|
};
|
|
|
|
/** "Help", in every language the app ships. */
|
|
export const HELP_WORDS: readonly string[] = Object.values(BARE_WORDS).flatMap(
|
|
(words) => words.help,
|
|
);
|
|
|
|
/** Greetings, in every language the app ships. */
|
|
export const GREETING_WORDS: readonly string[] = Object.values(
|
|
BARE_WORDS,
|
|
).flatMap((words) => words.greeting);
|