Building a Trilingual Anki Pipeline with iOS Shortcuts and the Claude API
I’m using Anki to take note of new vocab while learning Thai, Mandarin, and spoken Cantonese at the moment, so every new word becomes eight fields of careful typing on a phone:
- Thai script
- Thai romanization
- Mandarin simplified
- Mandarin pinyin
- Cantonese traditional
- Cantonese jyutping
- English gloss
- Optional notes about where the equivalence leaks (e.g. contextual differences)
That gets really time-consuming when I’m trying to capture a word in the moment. I wanted a way to draft a card in one text box, then have it appear in my deck with a single tap.
Add Trilingual Anki is a tool I built using the iOS Shortcus app: type a word or phrase in any of the three languages and it calls Claude API, which returns a raw JSON card: Thai script with Paiboon romanization, simplified Mandarin with pinyin, traditional Cantonese with jyutping, an English gloss, and optional notes. Two prompt rules do the heavy lifting:
- Cantonese must be the spoken word, never the written-Chinese reading of the Mandarin (畀 not 給, 係 not 是, 冇 not 沒有).
- Never force an equivalent — if a language lacks a natural match, give what a native speaker would actually say and flag the gap with ⚠️ in the notes.
The draft comes back in an alert: OK adds the card through AnkiMobile’s x-callback URL, Cancel discards it. That alert is the entire quality system where I can check the draft and re-roll with better added context if it doesn’t meet my standards. Rejecting and re-rolling costs a few seconds and a fraction of a cent.
The hard parts were in the handoff between Shortcuts and Anki. AnkiMobile gets fields as URL query parameters, and iOS’s URL Encode action leaves : ; , . / raw, which is fine in a query string, but enough to break field delivery inside values. I used AI to diagnose this by comparing two nearly identical 900-character URLs that differed only in punctuation encoding. The eventual fix is a sanitizer step that percent-encodes the risky characters, plus a modification to the API prompt that strips unneeded punctuation and nudges the model toward em dashes.
Enjoy Reading This Article?
Here are some more articles you might like to read next: