[Libguestfs] Translations using Weblate

Pino Toscano ptoscano at redhat.com
Fri Aug 21 14:50:38 UTC 2020


Hi,

with the changes done last week in libguestfs and virt-v2v, we are now
using Weblate as our translation infrastructure; in particular, we are
using the Fedora instance:
  https://translate.fedoraproject.org/projects/libguestfs/

I set up all the various components required, i.e. messages and docs
for libguestfs and virt-v2v. The docs components are "linked" to the
components of the messages, as they are in the same repository. This
means that
- updating the repository of the component with the messages will
  trigger the update of the docs component automatically
- there is only one pull request for the repository with all the changes
  in the different components

The recent changes I did also imply some workflow changes:
1) the translation catalogs (i.e. the .pot files) are no more generated
   automatically during the build. This proved challenging, as updating
   the catalog required complete dependencies for all the sources,
   which may not be built depending on the available dependencies
2) we will need to regenerate the translation catalogs manually, at
   least for now; considering we are on github, a possible way to
   automate this is to use a GitHub Action [1], similar to the one we
   set up in virt-manager [2]
3) similar to (1), .po files are no more updated from the template
   during the build; Weblate handles them now, and I enabled the Weblate
   addon to run msgmerge every time the template changes

As I mentioned above, now Weblate "owns" changes to the translations:
this means we don't have to change them manually anymore, and issues
must be fixed directly in Weblate (which will be then send upstream).
Weblate has a lot of checks for problems in messages and even style
nits, so hopefully this should greatly reduce the issues in
translations.

An important configuration bit needed is to notify Weblate every time
the are commits pushed in the repositories; this is done by using GitHub
webhooks, which must be configured per repository as described in the
Weblate documentation [3].

The preferred way to get translation updates on GitHub/Gitlab is via
PRs; I know that we generally don't use them, however I believe we
can accept them from Weblate, as it would simplify things a bit.
There are not often changes in translations, so IMHO there will not
be a big traffic of PRs. Also, I configured our components to push
translations changes to upstream after 24h of no activity, and to batch
commits by author, so there will be less commits sent as PR.
The default configuration in GitHub for PR merging is with git merges,
which can be changed: in the "Settings" tab of a repository, select
"Options", then uncheck "Allow merge commits". Weblate takes care of
rebasing each PR according to the upstream changes, so a "fast forward"
merge will usually work.

I think I wrote down all the important bits I wanted to mention.
Of course there will be more things to mention in the future that I
cannot think about at the moment, so please do ask for anything
related.

[1] https://github.com/features/actions
[2] https://github.com/virt-manager/virt-manager/blob/master/.github/workflows/translations.yml
[3] https://docs.weblate.org/en/latest/admin/continuous.html#automatically-receiving-changes-from-github

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20200821/5ad76b93/attachment.sig>


More information about the Libguestfs mailing list