Problem
AI translation often misses or incorrectly handles three specific element types in lectures:
- Code comments — inline comments in code cells that should be translated but are frequently left in English or translated incorrectly
- Figure labels — axis labels, titles, legends, and annotations in matplotlib/plotly figures that need localisation
- LaTeX — display math and inline math containing text strings (e.g.
\text{marginal cost}) that should be translated while preserving the math structure
These are easy to miss during bulk translation because they're embedded inside code blocks or math environments that translators (human or AI) tend to skip over.
Proposal
Build a qetranslate review CLI command (or similar) that:
- Extracts all code comments, figure labels, and LaTeX text elements from a translated lecture
- Presents them one-by-one for review (similar to
qebench translate's interactive loop)
- Shows source + current translation side by side for each element
- Allows quick accept/edit/flag actions
- Writes corrections back to the translated file
Element Detection
| Element |
Detection Strategy |
| Code comments |
Parse # comments in Python code cells |
| Figure labels |
Detect plt.xlabel(), plt.title(), ax.set_ylabel(), legend strings, annotation strings etc. |
| LaTeX text |
Extract \text{...}, \mathrm{...}, \textbf{...} and similar commands from math blocks |
Workflow
qetranslate review lectures/intro.md --lang zh-cn
Would cycle through each extractable element showing:
[Code Comment] lectures/intro.md:42
EN: # Calculate the steady state
ZH: # 计算稳态
[a]ccept / [e]dit / [s]kip / [f]lag?
Integration with action-translation
- Flagged items could feed into the translation glossary or prompt instructions
- Corrections could be committed directly or collected into a PR
- Could run as a post-translation QA step in the sync workflow
Open Questions
- Should this live as a subcommand of the existing
qetranslate CLI or as a standalone tool?
- Should it also handle MyST directive options (e.g.
:label:, :name:) that contain translatable text?
- Priority: start with code comments (most common miss) then expand to figures and LaTeX?
Problem
AI translation often misses or incorrectly handles three specific element types in lectures:
\text{marginal cost}) that should be translated while preserving the math structureThese are easy to miss during bulk translation because they're embedded inside code blocks or math environments that translators (human or AI) tend to skip over.
Proposal
Build a
qetranslate reviewCLI command (or similar) that:qebench translate's interactive loop)Element Detection
#comments in Python code cellsplt.xlabel(),plt.title(),ax.set_ylabel(), legend strings, annotation strings etc.\text{...},\mathrm{...},\textbf{...}and similar commands from math blocksWorkflow
Would cycle through each extractable element showing:
Integration with action-translation
Open Questions
qetranslateCLI or as a standalone tool?:label:,:name:) that contain translatable text?