On Fri, Mar 10, 2023 at 17:14:32 +0000, Daniel P. Berrangé wrote:
Even if fixed, it might be worth switching the .pot file anyway, but
this can't be done without us bulk updating the translations, and
bulk re-importing them, which will be challenging. We'll almost
certainly want to try this on a throw-away repo in weblate first,
not our main repo.
I was able to come up with steps leading to the desired state:
0. lock weblate repository
1. update libvirt.pot from the most recent potfile job
2. push to libvirt.git
2. wait for translations update from Fedora Weblate and merge it
3. pull from libvirt.git
4. apply the first 50 patches from this seires (with required changes
to make sure all translation strings are updated)
5. update all po files with the attached script
6. update libvirt.pot by running meson compile libvirt-pot
7. apply patch 51 of this series
8. push to libvirt.git
9. wait for translations update from Fedora Weblate and merge it
10. unlock weblate repository
The process takes about an hour if we're lucky as weblate is quite slow
when processing such large amount of changes.
The result can be seen at
https://gitlab.com/jirkade/libvirt/-/commits/format-strings
and the corresponding weblate repository at
https://translate.fedoraproject.org/projects/libvirt/test/
I used d05ad0f15e737fa2327dd68870a485821505b58f commit as a base.
If we agree this is a reasonable approach, I think we should apply it
just after a release to give translators the whole release cycle to
check or update the translations if they wish so.
The attached script analyzes a single po file and updates all msgid
strings to use permutable format strings. It also tries to update all
translations, but only if the format strings in them exactly match
(including their order) the corresponding msgid format string. That is,
a msgstr will not be updated if format strings in it were incorrect or
reordered or they already used the permutable form. That is, the
processing should be a NO-OP except for strings that already used
permutable format in msgstr, such translations were failing c-format
check in weblate before but would be marked as correct now.
Jirka