tchx84 / Gameeky

Play, create and learn
GNU General Public License v3.0
70 stars 12 forks source link

Use mdpo to translate documentation #112

Closed rffontenelle closed 4 months ago

rffontenelle commented 4 months ago

Let's us have another shot at documentation translation via Gettext

The first commit adds three new Python scripts in docs/po:

Note: Installing mdpo is required.

The second commit contributed removes docs/basics/es/index.md, so the changes after running build_md.py are visible.

The third commit updates CONTRIBUTING.md with the use of these scripts for updating documentation translation.

For reference, other discussions on this matter: #69 and #109

tchx84 commented 4 months ago

@rffontenelle thanks, I review this carefully during the week.

Also, let me brain-dump something regarding the packaging and distribution issues... this is what I think we should do for now to get done with this in way we achieve our most important goals: gettextize this WHILE not making it harder for people to build this project.

  1. Let's give up (for now) on the idea that everything should be generated at build time e.g., not requiring pandoc nor mdpo at build time and therefore generating nothing at build time.
  2. Instead, let's just move these steps out of the build pipeline and make them manual (for now).
  3. So, to achieve that we could just include the *.HTML file as a source.

The pros are:

The cons are:

The process (e.g., say to update the docs) could be like this:

  1. Someone updates something in docs/basics/en/index.md, a.k.a the source.
  2. Same someone runs ninja gameeky-docs-update to update the template and translation files.
  3. Same someone updates one or more the translations.
  4. Someone runs ninja gameeky-docs-generate to first (re)generate the *.md file and then the *.HTML file.
  5. Someone commits the updated *.HTML files and sends a PR.

So it's basically 2 steps, plus regular change/git stuff.

Notes:

We would document this process in a docs/README.md.

The alternative to this would be to move to something completely different.

rffontenelle commented 4 months ago

We can set up a GitHub workflow that runs triggered by push event with a path filter of doc/po/*.po, that converts po -> markdown -> html. Finally, auto commit or open a pull requests.

The PO update process could also be an workflow that is run manually from rhe workflows page (Actions > select workflow > run manually). It could be used to run before a new release.

tchx84 commented 4 months ago

We can set up a GitHub workflow that runs triggered by push event with a path filter of doc/po/*.po, that converts po -> markdown -> html. Finally, auto commit or open a pull requests.

The PO update process could also be an workflow that is run manually from rhe workflows page (Actions > select workflow > run manually). It could be used to run before a new release.

Correct, that's what I meant by dist pipeline, it can generate a tar with the generated HTML (so we don't need to include it as source anymore). Then people can build it from there, without the need of these tools.

EDIT: See meson's add_dist_script, so the HTML will be generated during meson dist and these HTML files will be included in final tarball (and not source)

tchx84 commented 4 months ago

@rffontenelle finally found the time to work on this.. this is the "manual" version of what we discussed earlier (the version where we includes the final HTML, so that we don't need to generate it at build time and therefore simplify users installations)... This is still WIP though (still need to polish things)

tchx84 commented 4 months ago

@rffontenelle I think this is ready for merging now... with a few caveats:

$ python3 docs/tools/update_pot.py docs/basics/src/en/index.md docs/basics/po/gameeky.pot
$ python3 docs/tools/update_po.py docs/basics/po --language es
$ python3 docs/tools/update_md.py docs/basics/src/ docs/basics/po/ --language es
$ python3 docs/tools/update_html.py docs/basics/src/ docs/basics/data/headers.xml docs/basics/po docs/basics/html/ --language es