Multilingual menu and tagclouds

Here is what I found to satisfy pt 4 (see initial post above) thanks to your suggestions, Texnixe.

The table lists pages/urls in given language only if corresponding “.lang.txt” file phisically exists. It bypasses Kirby internal logic with strpos() which allows to have correct aswers even when there are pages that doesn’t exist in default language.

<table>
 <thead>
  <tr>
   <th>EN</th>
   <th>FR</th>
   <th>ES</th>
  </tr>
</thead>
<tbody>

<?php
$languages = $site->languages();
foreach ($site->index() as $p) {
$pen = $p->content('en')->root();
$pfr = $p->content('fr')->root();
$pes = $p->content('es')->root();
  foreach($languages as $l) {
    if($p->content()->language() == $l) {

echo '<tr>';

// EN
if(strpos($pen, 'en.txt')) { 
echo '<td><a href="' . $p->url('en') . '">' . $p->content('en')->title() . '</a></td>';
} else { 
echo '<td>---</td>';
}

// FR
if(strpos($pfr, 'fr.txt')) { 
echo '<td><a href="' . $p->url('fr') . '">' . $p->content('fr')->title() . '</a></td>';
} else { 
echo '<td>---</td>';
}

// ES
if(strpos($pes, 'es.txt')) { 
echo '<td><a href="' . $p->url('es') . '">' . $p->content('es')->title() . '</a></td>';
} else { 
echo '<td>---</td>';
}

echo '</tr>';
    }
  }
}
?>

 </tbody>
</table>

It could be compacted with another foreach loop but I’m fed up with it.

Hope it can be useful for someone before $page->content($lang)->exists() acts as expected.

By the way I ask myself whether I shouldn’t use similar approach to filter tagcloud by languages.
Any better idea ?