Dynamic header.php snippet to reuse for multiple language

I’m trying to figure out how to reuse my header.php snippet for three languages.
There is quiet some static html content in it and I wondered if this is possible the way Kirby works.

The caption of the header image as well as a paragraph and some links in the navigation should change according to the selected language.

    <h2>Title in multiple language</h2>
    <p>Paragraph in multiple language</p>
    <p>Different title in multiple language</p>

What would be the best way to set up the header snippet more dynamically?


Could you please point out what exactly you want to change on a per language basis? The page links change automatically anyway, so what is actually left apart from the background image which doesn’t seem language specific?

On a side note if would be better to write:

<?php foreach ($site->children()->listed() as $subpage):  ?>
    <a href="<?= $subpage->url() ?>"><?= $subpage->title() ?></a>
<?php endforeach ?>

instead of the curly braces.

I updated the HTML, these are the parts that should be able to change according to different languages.
The menu links are dynamic already indeed.

Then I’d store the stuff in different languages in the content files and output the fields in which you store the content the snippet. After all, that’s the whole point of the multi-language feature.

Ok thanks!

If you can’t figure it out, let me know and I’ll give you more details.

Worked perfectly, thanks!