Verify translations
This recipe repairs English translations in a 1,000-note Japanese deck. It uses a local YAML file so you can inspect the model’s work before changing Anki and resume safely if processing is interrupted.
Assume the deck is named Japanese Core 1k and each note has Japanese and
Translation fields.
Export the deck
Section titled “Export the deck”Open Anki, then export the notes:
anki-llm export "Japanese Core 1k" --output notes.yamlA row looks like this:
- noteId: 1512345678901 Japanese: 猫は机の上にいます。 Translation: The cat is on the desk.- noteId: 1512345678902 Japanese: 彼は毎日公園を散歩します。 Translation: He strolls in the park every day.YAML keeps multiline fields readable and is easy to compare after processing. Anki can be closed after export. See Process a file for the file lifecycle and resume rules.
Write the translation prompt
Section titled “Write the translation prompt”Create prompt-ja-en.md:
---output: field: Translation require_result_tag: true---
You are an expert Japanese-to-English translator.
Translate this Japanese sentence into English: {Japanese}
Guidelines:- Preserve nuance and meaning.- Write natural, idiomatic English.- When practical, preserve clues to the original Japanese grammar.
Briefly analyze the sentence and translation choices. Put only the finaltranslation inside <result></result> tags.The model can reason in its response, but only the final tagged value reaches
the Translation field. See Write prompts
for result-tag behavior.
Test a small sample
Section titled “Test a small sample”First verify placeholder expansion without calling the model:
anki-llm process-file notes.yaml \ --output notes-translated.yaml \ --prompt prompt-ja-en.md \ --dry-runThen process three translations and review the proposed changes:
anki-llm process-file notes.yaml \ --output notes-translated.yaml \ --prompt prompt-ja-en.md \ --model gemini-2.5-flash \ --previewCheck proper names, omitted subjects, tense, register, and sentences whose meaning depends on context. Revise the prompt and repeat until the sample is reliable.
Process all notes
Section titled “Process all notes”Run the full batch:
anki-llm process-file notes.yaml \ --output notes-translated.yaml \ --prompt prompt-ja-en.md \ --model gemini-2.5-flash \ --batch-size 10The output is saved incrementally. If the command stops, rerun the same command and output path. Completed rows are skipped, while failed rows remain eligible for retry.
The terminal summary reports successes, failures, elapsed time, token totals,
and estimated cost. See the process-file reference
for concurrency, limits, retries, and diagnostic logging.
Review the result
Section titled “Review the result”Compare the original and processed files:
git diff --no-index notes.yaml notes-translated.yamlSpot-check a representative sample, including short fragments, long sentences, slang, names, and cards with HTML. If a systematic error appears, adjust the prompt and run against a fresh output path or intentionally reprocess with the force option.
Import the translations
Section titled “Import the translations”Open Anki again and update the original notes:
anki-llm import notes-translated.yaml --deck "Japanese Core 1k"The exported noteId values identify existing notes, so the import updates them
instead of creating replacements. The importer reports the valid destination
fields and partitions rows into additions and updates. With all 1,000 exported
IDs intact, this recipe produces 0 additions and 1,000 updates. The note type is
inferred when the deck has a single type. See the
import reference when you need an
explicit note type or key field.