xenocrat / chyrp-lite

An ultra-lightweight blogging engine, written in PHP.
https://chyrplite.net/
BSD 3-Clause "New" or "Revised" License
402 stars 42 forks source link

Blog translation #247

Closed RatCornu closed 4 months ago

RatCornu commented 6 months ago

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.

xenocrat commented 6 months ago

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?

RatCornu commented 6 months ago

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

xenocrat commented 6 months ago

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>.

RatCornu commented 6 months ago

Okay I got it, thanks for the help!