fix(i18n): address the ru review — units, Cyrillic regexes, locale registry

Dose bank
- DRUG_UNIT learns мг / мкг / мл / ЕД / МЕ, so "2,4 мг" anchors a dose again.
- The bank matches verb-first Russian word order too ("принимайте 2 таблетки",
  "пропустите дозу метформина", "начните с 5 мг"), and the Cyrillic drug names
  people actually see on the box; the deferral words ("спросите врача",
  "как назначено") stand those shapes down.

Cyrillic-safe regexes
- \w and \b are ASCII in JavaScript: every stem in the ru bank and in
  population-norms/ru.ts is [а-яё]*, and the word edges are lookarounds
  (?<![а-яёa-z]), so «высокий риск» and «нормальный диапазон» match again.
- coach-prose-grounding: Russian month names in the genitive, a space as the
  thousands separator in parseLocaleNumber and numFrag, and Cyrillic-safe
  edges around the written-date pattern.

Registered everywhere a locale has to be
- targetLanguageName() returns "Russian", so the coach, the period narrative
  and the document descriptions stop saying "write in English".
- i18n-key-tool.mjs, split-description.mjs, LOINC name normalisation (it
  stripped Cyrillic, so no Russian lab name resolved), HOST_TLDS (ru/by/kz/ua),
  no-key-fallbacks (32 tables), country-label, the AUDIT-C standard drink.
- docs/api/openapi.yaml regenerated.

Questionnaires
- The PHQ-9 / GAD-7 source comments no longer claim no validated Russian
  version exists (Zolotareva 2023; Pfizer's official screeners).
- WHO-5 items are gender-neutral: «чувствовал(а)».
- "body fat" and "fat mass" both read «Жировая масса»; body fat is now
  «Процент жировой массы», which is what the two metrics measure.

Tests
- ru in the 13 locale tables, plus mood, onboarding, instruments, clinician
  view, status summary, describe screen, citation coverage and LOINC.
- i18n-no-dot-separator: the ru bundle is exempt from the dash rule (a spaced
  dash is Russian punctuation, not a fragment join); the middle dot still
  fails there.
- Two 800-line baselines raised by the 12 and 5 lines this change adds.

pnpm typecheck, pnpm openapi:check and the full suite (36 316 tests) pass.
This commit is contained in:
l1137l committed 2026-11-02 20:22:03 +00:00
1 parent 6b9d222643
commit 48bfbad4e6
44 files changed
+431 -70

No files matched your search

@@ -223,9 +223,9 @@ const FULL_RECORD = {
const DOTTED_KEY = /\b[a-z][A-Za-z0-9]*(\.[A-Za-z0-9_]+){2,}\b/g;
describe("<ClinicianView> resolves every label in every locale", () => {
it("covers all nine shipped locales", () => {
it("covers all ten shipped locales", () => {
// A floor: an empty locale list would make the loop below assert nothing.
expect(locales.length).toBe(9);
expect(locales.length).toBe(10);
});
for (const locale of locales) {
@@ -93,6 +93,7 @@ describe("CoachReadStrip — the latest reading's day", () => {
ko: "10월 1일",
pl: "1 października",
"pt-BR": "1 de outubro",
ru: "1 октября",
};
for (const [locale, date] of Object.entries(expected) as Array<
[Locale, string]
@@ -41,7 +41,7 @@ const REQUIRED_KEYS = [
];
describe("measurement-reminder + bulk-share dynamic i18n keys", () => {
it("discovers all nine shipped locales", () => {
it("discovers all ten shipped locales", () => {
expect(LOCALES.map((l) => l.locale).sort()).toEqual([
"de",
"en",
@@ -52,6 +52,7 @@ describe("measurement-reminder + bulk-share dynamic i18n keys", () => {
"nl",
"pl",
"pt-BR",
"ru",
]);
});
@@ -8,6 +8,7 @@ import {
} from "@/lib/integrations/connection-health";
import de from "../../../../../messages/de.json";
import ru from "../../../../../messages/ru.json";
import en from "../../../../../messages/en.json";
import es from "../../../../../messages/es.json";
import fr from "../../../../../messages/fr.json";
@@ -36,6 +37,7 @@ const CATALOGS: Record<Locale, unknown> = {
nl,
ko,
"pt-BR": ptBR,
ru: ru,
};
function translator(locale: Locale) {