Spaces:
Sleeping
Sleeping
KevinIsInCoding Claude Sonnet 4.6 commited on
FIX: Translate report field labels (Trial, Sponsor, PI, etc.) in i18n mode (#4)
Browse filesAdd REPORT_LABELS dict with translated field names for ZH/ES/HI and inject
them as explicit mappings in the language directive so the research agent uses
the correct labels in every trial entry. Proper nouns (hospital names, drug
names, etc.) remain untouched per the existing preserve rule.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- translations.py +83 -3
translations.py
CHANGED
|
@@ -70,21 +70,101 @@ _PRESERVE = (
|
|
| 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
|
|
|
|
| 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
|
|
|
|
| 84 |
),
|
| 85 |
"hi": (
|
| 86 |
"महत्वपूर्ण: आपको केवल हिन्दी में उत्तर देना है। "
|
| 87 |
"केवल अपना स्वयं का व्याख्यात्मक पाठ अनुवाद करें — वे शब्द जो आप रोगी को लिखते हैं। "
|
| 88 |
-
f"{_PRESERVE}\n
|
|
|
|
| 89 |
),
|
| 90 |
}
|
|
|
|
| 70 |
"If you are unsure whether something is a proper noun, leave it in English."
|
| 71 |
)
|
| 72 |
|
| 73 |
+
# Translated report field labels used in the RESEARCH_SYSTEM output format.
|
| 74 |
+
REPORT_LABELS: dict[str, dict[str, str]] = {
|
| 75 |
+
"en": {
|
| 76 |
+
"trial": "Trial",
|
| 77 |
+
"sponsor": "Sponsor",
|
| 78 |
+
"pi": "Principal Investigator",
|
| 79 |
+
"contact": "Contact",
|
| 80 |
+
"summary": "Summary",
|
| 81 |
+
"criteria": "Qualification criteria",
|
| 82 |
+
"link": "Link",
|
| 83 |
+
"not_listed": "Not listed",
|
| 84 |
+
"eap": "Expanded Access",
|
| 85 |
+
"next_steps": "Next steps",
|
| 86 |
+
"miles": "mi",
|
| 87 |
+
},
|
| 88 |
+
"zh": {
|
| 89 |
+
"trial": "试验",
|
| 90 |
+
"sponsor": "申办方",
|
| 91 |
+
"pi": "主要研究者",
|
| 92 |
+
"contact": "联系方式",
|
| 93 |
+
"summary": "简介",
|
| 94 |
+
"criteria": "入组资格",
|
| 95 |
+
"link": "链接",
|
| 96 |
+
"not_listed": "未列出",
|
| 97 |
+
"eap": "扩展访问",
|
| 98 |
+
"next_steps": "后续步骤",
|
| 99 |
+
"miles": "英里",
|
| 100 |
+
},
|
| 101 |
+
"es": {
|
| 102 |
+
"trial": "Ensayo",
|
| 103 |
+
"sponsor": "Patrocinador",
|
| 104 |
+
"pi": "Investigador Principal",
|
| 105 |
+
"contact": "Contacto",
|
| 106 |
+
"summary": "Resumen",
|
| 107 |
+
"criteria": "Criterios de elegibilidad",
|
| 108 |
+
"link": "Enlace",
|
| 109 |
+
"not_listed": "No disponible",
|
| 110 |
+
"eap": "Acceso Expandido",
|
| 111 |
+
"next_steps": "Próximos pasos",
|
| 112 |
+
"miles": "mi",
|
| 113 |
+
},
|
| 114 |
+
"hi": {
|
| 115 |
+
"trial": "परीक्षण",
|
| 116 |
+
"sponsor": "प्रायोजक",
|
| 117 |
+
"pi": "प्रमुख अन्वेषक",
|
| 118 |
+
"contact": "संपर्क",
|
| 119 |
+
"summary": "सारांश",
|
| 120 |
+
"criteria": "पात्रता मानदंड",
|
| 121 |
+
"link": "लिंक",
|
| 122 |
+
"not_listed": "सूचीबद्ध नहीं",
|
| 123 |
+
"eap": "विस्तारित पहुँच",
|
| 124 |
+
"next_steps": "अगले कदम",
|
| 125 |
+
"miles": "मील",
|
| 126 |
+
},
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def _labels_directive(lang: str) -> str:
|
| 131 |
+
if lang == "en":
|
| 132 |
+
return ""
|
| 133 |
+
lb = REPORT_LABELS[lang]
|
| 134 |
+
return (
|
| 135 |
+
f"Use these translated field labels in every trial entry of your report:\n"
|
| 136 |
+
f" Trial → {lb['trial']}\n"
|
| 137 |
+
f" Sponsor → {lb['sponsor']}\n"
|
| 138 |
+
f" Principal Investigator → {lb['pi']}\n"
|
| 139 |
+
f" Contact → {lb['contact']}\n"
|
| 140 |
+
f" Summary → {lb['summary']}\n"
|
| 141 |
+
f" Qualification criteria → {lb['criteria']}\n"
|
| 142 |
+
f" Link → {lb['link']}\n"
|
| 143 |
+
f" 'Not listed' → {lb['not_listed']}\n"
|
| 144 |
+
f" 'Expanded Access' (EAP label) → {lb['eap']}\n"
|
| 145 |
+
f" 'Next steps' section heading → {lb['next_steps']}\n"
|
| 146 |
+
f" Distance unit 'mi' → {lb['miles']}\n"
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
|
| 150 |
LANGUAGE_DIRECTIVE: dict[str, str] = {
|
| 151 |
"en": "",
|
| 152 |
"zh": (
|
| 153 |
"IMPORTANT: You must respond ONLY in Simplified Chinese (简体中文). "
|
| 154 |
"Translate only your own explanatory text — the words YOU write to the patient. "
|
| 155 |
+
f"{_PRESERVE}\n"
|
| 156 |
+
+ _labels_directive("zh") + "\n"
|
| 157 |
),
|
| 158 |
"es": (
|
| 159 |
"IMPORTANTE: Debes responder ÚNICAMENTE en español. "
|
| 160 |
"Traduce solo tu propio texto explicativo — las palabras que TÚ escribes al paciente. "
|
| 161 |
+
f"{_PRESERVE}\n"
|
| 162 |
+
+ _labels_directive("es") + "\n"
|
| 163 |
),
|
| 164 |
"hi": (
|
| 165 |
"महत्वपूर्ण: आपको केवल हिन्दी में उत्तर देना है। "
|
| 166 |
"केवल अपना स्वयं का व्याख्यात्मक पाठ अनुवाद करें — वे शब्द जो आप रोगी को लिखते हैं। "
|
| 167 |
+
f"{_PRESERVE}\n"
|
| 168 |
+
+ _labels_directive("hi") + "\n"
|
| 169 |
),
|
| 170 |
}
|