Provide per-chapter Urdu translation toggle and manage translated content delivery. Use when translating chapters, caching translations, or implementing language toggles.
Translation pipeline
Storage
.ur.mdx) alongside Englishtranslations(section_id, lang, content)lang for bilingual RAGFrontend
Quality
# Translation function
async def translate_section(content: str, glossary: dict) -> str:
prompt = f"""Translate to Urdu. Keep technical terms from glossary.
Glossary: {glossary}
Content: {content}
"""
# Call OpenAI
return translated_content
// glossary.json
{
"Physical AI": "فزیکل اے آئی",
"Humanoid Robot": "ہیومنائیڈ روبوٹ",
"ROS 2": "ROS 2",
"NVIDIA Isaac": "NVIDIA Isaac"
}