Why does spell checking not working in German?

I’m having trouble with spell checking in the browser application when setting the language to German using:

#set text(lang: "de")

No spelling errors are being detected at all.

However, when I set the language to English:

#set text(lang: "en")

the spell checker works as expected. I’ve tested this on Firefox, Chrome, and Edge, but the issue persists across all browsers.

Its also not workign with an minimal example as:

#set text(lang: "de", region: "de")
Finde den Fehlr.

It’s a known issue (not a bug) as the web app uses a library called hunspell which relies on a rather complicated dictionary file format for spell checking. The issue stems from the fact that the only available German dictionary has a license incompatible with the web app and contacting its author to purchase the dictionary has not yet led to any results unfortunately.

1 Like

@xkevio is it be possible to expose an interface in the web app to bring a local dictionary or strip all the code and export the text only in order to check it externally? I write a lot in German, and this particular shortcoming makes it significantly harder to directly use typst for projects – I am stuck writing all the text first and then typesetting it in Typst.

1 Like

The irony here is that Tip #31 in the web app which explains users how to enable spellchecking is using the German language as an example.

oops

1 Like

A simple spellchecker for German is the following:

#import "@preview/hy-dro-gen:0.1.2" as hy
#assert(hy.exists("de"))


#show regex("\p{L}{2,}"): word => {
    if word.text not in (
        "bspw",
        "cm",
        "Dr",
        "mm",
        "nm",
        "vllt",
    ) {
        let syllables = hy.syllables(lower(word.text), lang: "de")
        if not syllables.all(s =>
            s.contains("a") or
            s.contains("ä") or
            s.contains("e") or
            s.contains("i") or
            s.contains("o") or
            s.contains("ö") or
            s.contains("u") or
            s.contains("ü") or
            s.contains("y")
        ) {
            panic("Spelling of word '", word.text, "' is unexpected.", syllables)
        }
    }
    word
}