KevinIsInCoding Claude Sonnet 4.6 commited on
Commit
7d5835c
·
unverified ·
1 Parent(s): eb6d0dc

FIX: Prevent translation of hospital names and proper nouns in i18n mode (#3)

Browse files

Language directives now explicitly instruct Claude to translate only its own
explanatory text and never modify hospital/facility names, drug names, sponsor
names, investigator names, trial titles, NCT IDs, or any proper nouns from
trial data. Unsure cases default to keeping the original English.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. translations.py +14 -6
translations.py CHANGED
@@ -62,21 +62,29 @@ UI: dict[str, dict[str, str]] = {
62
  },
63
  }
64
 
 
 
 
 
 
 
 
 
65
  LANGUAGE_DIRECTIVE: dict[str, str] = {
66
  "en": "",
67
  "zh": (
68
  "IMPORTANT: You must respond ONLY in Simplified Chinese (简体中文). "
69
- "Every word you write to the patient must be in Chinese. "
70
- "Standard medical abbreviations (ALSFRS-R, FVC, SOD1, etc.) may remain in their original form.\n\n"
71
  ),
72
  "es": (
73
  "IMPORTANTE: Debes responder ÚNICAMENTE en español. "
74
- "Cada palabra que escribas al paciente debe estar en español. "
75
- "Las abreviaturas médicas estándar (ALSFRS-R, FVC, SOD1, etc.) pueden mantenerse en su forma original.\n\n"
76
  ),
77
  "hi": (
78
  "महत्वपूर्ण: आपको केवल हिन्दी में उत्तर देना है। "
79
- "रोगी िखी गई हर ात हि ें चाहि। "
80
- "मानक चिकित्सा संक्षेप (ALSFRS-R, FVC, SOD1, आदि) अपने मूल रूप में रह सकते हैं।\n\n"
81
  ),
82
  }
 
62
  },
63
  }
64
 
65
+ _PRESERVE = (
66
+ "NEVER translate or modify: hospital/facility names, drug/treatment names, "
67
+ "sponsor names, principal investigator names, trial titles, NCT IDs, "
68
+ "medical abbreviations (ALSFRS-R, FVC, SOD1, etc.), gene names, or any "
69
+ "other proper nouns from the trial data. Keep all of these exactly as-is. "
70
+ "If you are unsure whether something is a proper noun, leave it in English."
71
+ )
72
+
73
  LANGUAGE_DIRECTIVE: dict[str, str] = {
74
  "en": "",
75
  "zh": (
76
  "IMPORTANT: You must respond ONLY in Simplified Chinese (简体中文). "
77
+ "Translate only your own explanatory text — the words YOU write to the patient. "
78
+ f"{_PRESERVE}\n\n"
79
  ),
80
  "es": (
81
  "IMPORTANTE: Debes responder ÚNICAMENTE en español. "
82
+ "Traduce solo tu propio texto explicativo las palabras que TÚ escribes al paciente. "
83
+ f"{_PRESERVE}\n\n"
84
  ),
85
  "hi": (
86
  "महत्वपूर्ण: आपको केवल हिन्दी में उत्तर देना है। "
87
+ "केवअपना स्वयं व्याख्या्मक पाठ अुवाकरें — वे शब्द ज आप रोगको लिखते हैं। "
88
+ f"{_PRESERVE}\n\n"
89
  ),
90
  }