I’ve a 2-lang website (FR and EN), the majority is in FR without translations. I don’t want that Kirby automatically shows FR articles when in EN.
I can’t find any method to get available languages of a page. Is there ?
Fatal error: Call to a member function code() on boolean
However $page->content()->language() seems to work, but only on translated article and returns an empty string in other cases. I would expect to return the default lang?
// get own language of page
$ownLang = $child->content()->language();
// if empty string, use default language
if ($ownLang == '') {
$ownLang = $site->defaultLanguage()->code();
}
// page doesn't exist in current language
if ( $site->language()->code() != $ownLang ) {
// do stuff
}