Foreign Dispatch

Can ideas from code editors be applied to writing in foreign languages?
Published

November 17, 2022

When you learn a new language, different skills must be practiced: reading, listening, speaking, writing. Writing is the one I find most difficult, involving a lot of friction and context switching. Foreign Dispatch is a new project, where I will build tools to make foreign language writing easier.

When I sit down to write a text in German, my goals are not the same as when I speak with another person. I want to expand my vocabulary, and learn how to express thoughts that I am currently unable to. I also want to focus on the grammar, making sure that I use the correct articles, and that my adjective endings are as they should be (no small feat in German), amongst many other things. This means that I spend a lot of time looking up words in dictionaries, checking my grammar book or searching the internet for how to write something in an idiomatic way. The constant context switching between my word processor and other tools was killing whatever flow I might have had.

I realized that code editors solve many of the same problems. Autocomplete lets programmers look up functions without consulting the documention, while linters suggest improvements. Leveraging the type system, code editors show information about variables or functions: what kind they are or what they do. Could a code editor be extended to make writing in foreign languages easier?

Autocomplete in VS Code

ESLint in VS Code

Documentation lookup in VS Code

With Foreign Dispatch I want to try to answer that question, by building a number of small prototypes, each exploring a different aspect of foreign language writing. The first prototype is Autocomplete, a small CodeMirror based editor. It allows you to look up words in an English-German dictionary without leaving the text editor. Instead, you type “@” followed by the English word, which will look up German translations, much like autocomplete in a code editor.

Foreign Dispatch Autocomplete in action

The code is availabe on GitHub, or you can try the online demo. The dictionary is based on data from excellent WikDict project, which provides data from Wiktionary as SQLite databases.

What’s next

After autocomplete, I want to tackle the prose equivalents of a linter and inline documentation.

The linter should propose grammar fixes, and possibly suggest more idiomatic ways of expressing something. I have experimented a bit with using GPT-3 to suggest grammar corrections, and have found that it does a much better job, than whatever is in e.g. Word or Google Docs at the moment.

Inline documentation is a bit more straightforward. Starting with German, I want to show word definitions, but also things such as noun gender and conjugation tables for verbs. The data that I need is available in WikDict.

If the individual experiments turn out well, I would ultimately want to package up everything in a single web app, or create a language server that could be used from code editors such as VS Code, coming full circle.