tchx84 / Gameeky

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

Use mdpo to translate documentation #109

Closed tchx84 closed 4 months ago

tchx84 commented 4 months ago

@rffontenelle I moved this here just discuss a few issues:

rffontenelle commented 4 months ago
  • First, there's another distribution issue, mdpo does not provide arm specific packages for Linux and to rebuild those it requires the Rust compiler 🤦 . Similar as with the other tool we tried, I don't think it's worth it to make the build environment that complex. There might be other solutions like providing dist packages that are built on supported architectures but that's a some extra work as well.

Do you know if Sphinx have ARM specific packages? It seems to support Markdown files and with a proper conf.py configuration file and we have most job done, although building different languages need to be a separate run (e.g. "-Dlanguages=pt_BR", "-Dlanguages=es", etc.)

  • Second, I integrated the steps of your script to meson (which answers your previous question), but not everything will work out as expected, e.g., msgmerge doesn't support multiple PO files and meson run_target can't run more than one command. Therefore, for this to work on multiple platforms that script would need to be broken down into separate tools (e..g, under docs/tools) and rewritten in Python.

So, one script for generating POT and updating PO files, and other script for generating the translated Markdown from PO files. Right?

tchx84 commented 4 months ago

Do you know if Sphinx have ARM specific packages?

Not sure, but I can check.

I seems to support Markdown files and with a proper conf.py configuration file and we have most job done, although building different languages need to be a separate run (e.g. "-Dlanguages=pt_BR", "-Dlanguages=es", etc.)

Interesting, have you tried this particular feature before? I have used Sphinx before, but haven't checked the i18n support.

So, one script for generating POT and updating PO files, and other script for generating the translated Markdown from PO files. Right?

Yes. But you could break down the first one in two as well, e.g., so we would have something similar to regular ninja gameeky-pot and ninja gameeky-update-po.

rffontenelle commented 4 months ago

Interesting, have you tried this particular feature before? I have used Sphinx before, but haven't checked the i18n support.

It is not exactly a feature. If you run sphinx-build (with usual parameters) it will only build English (or whatever source language is set in conf.py). To build other languages, one must pass -D language=$LANG so that, combined with locale_dirs conf passed in CLI or set in conf.py, it looks for the PO file and build translated doc. Sphinx doesn't build multiple languages at once, see https://github.com/sphinx-doc/sphinx/issues/11713

See Internationalization in Sphinx docs for more info.

(In my previous message I wrote incorrectly the flag 'language' as 'languages' (plural), and that's a invalid conf. Fixed now)

Yes. But you could break down the first one in two as well, e.g., so we would have something similar to regular ninja gameeky-pot and ninja gameeky-update-po.

Got it.

rffontenelle commented 4 months ago

Uploading the scripts, as I don't have commit permissions to your merge request (appended '.txt' to be able to upload):

tchx84 commented 4 months ago

@rffontenelle create a new branch off this branch :) and send a new PR