In a two language setup, no matter whether a translation file exists or not, it always links to the error page of the given language.
As I can’t find any references to either $page->content($language->code())->language() or $site->language() in the Kirby 3 docs I am wondering if the example is still up to date?
Sorry for the confusion, I think we overlooked to update this properly for Kirby 3. $site->language() is indeed outdated code, should be $kirby->language()
$page->content($language->code())->language() should be replaced with $page->translation(string $languageCode), I think.
But I wonder if this really makes sense. I’d probably only show the link to the other translation for existing translations, or “disable” the link (i.e. only show text, not an anchor tag) for a non-existing translation. Or maybe send the user to the home page.