chyrp-lite icon indicating copy to clipboard operation
chyrp-lite copied to clipboard

Blog translation

Open RatCornu opened this issue 11 months ago • 4 comments

Hello! I started a small blog with chyrp lite and I love this engine! It's very simple to understand.

I've just wondered: is it currently possible to translate all the posts/pages/... in another language? Currently, I'm writing it in English and I would like to also have it in French if possible.

RatCornu avatar Mar 27 '24 19:03 RatCornu

Hello there,

Thank you for the kind words! I'm very pleased you are enjoying Chyrp Lite. :-) Do you want to add an automatic/machine translation, or do you want to translate the text yourself and present both versions as reading options?

xenocrat avatar Mar 28 '24 08:03 xenocrat

I would like to translate it myself if possible, and have a button or something else to switch between versions.

RatCornu avatar Mar 28 '24 11:03 RatCornu

There's a few different ways you could do this: some involving a module and/or a bit of theme customisation, but the simplest of all is probably to use the summary HTML element. For example, when editing your blog post/page in the admin console, you would add the following to the bottom (or top, as your prefer):

Text of your English post or page. This can be anything you want, and include HTML/Markdown styling.

<details>
  <summary>Version en français</summary>

French translation of the English text goes here. This can be anything you want, and include HTML/Markdown styling.

</details>

The summary element is great because it doesn't require any customisation of a theme or writing any code to handle the behaviour. It just works without any fuss. If you want the text visible by default instead of hidden, just use <details open>.

xenocrat avatar Mar 28 '24 12:03 xenocrat

Okay I got it, thanks for the help!

RatCornu avatar Mar 30 '24 14:03 RatCornu