Multi-lingual snippets

Hi there,

I’m new to this and struggling with something that is probably really simple.

I have a website in French and I am now adding English. In order to avoid repeating myself, I have created snippets (header.php, footer.php) which are being reused in all my templates. So far, I’ve managed to translate my pages following the instructions here but isn’t there a way to translate snippets?

Thanks,
Fivos

What do you want to translate in your snippets? Can you give an example?

Just text, like contact info within the < footer >, etc.

Edit: To be more precise, I would like the user to be able to translate the text within the snippets, the same way she can translate pages.

Don’t hardcode your stuff in the snippet, then. Put it into the Site settings, where the user can edit it.

I.e. add some fields to your site.yml blueprint, then call them in your snippets.

I can’t believe I didn’t think of that and just hardcoded stuff in the snippet. Thank you Sonja!

1 Like