On Mon, Mar 27, 2023 at 01:08:09PM +0200, Jiri Denemark wrote:
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.
So I went back to patch #1 in your series, and ran the attached script
on libvirt.pot, then ran 'msgmerge libvirt.pot libvirt.pot', to
canonicalize formatting,then finally compared my result to the libvirt.pot
created by this series. In theory the result should be identical, if the
script is correct and your update of translatable messages are also correct.
I found the following differences (all good ones)
-msgid "Could not find vf/instanceId %1$u/%2$s in netlink response"
+msgid "Could not find vf/instanceId %1$u/%2$s in netlink response"
You deleted excess whitespace.
-msgid "Device alias was not set for %1$s controller with index %2$d"
+msgid "Device alias was not set for %1$s controller with index %2$d "
You deleted trailing whitespace
-msgid ""
-"Target device PCI address %1$04x:%2$02x:%3$02x.%4$d does not match source "
-"%5$04x:%6$02x:%7$02x.%8$d"
+#: src/conf/domain_conf.c:19589
+msgid "Target device PCI address "
You fixed problem where xgettext can't expand messages using cpp string
concatenation, very good !
-msgid "bad prefix %1$d for network %2$s when checking range %3$s - %4$s"
+msgid "bad prefix %1$d for network %2$s when checking range %3$s - %4$s"
You deleted excess whitespace.
-"cannot hot unplug %1$s device with PCI guest address: %2$04x:%3$02x:%4$02x."
-"%5$d - not allowed by controller"
+msgid "cannot hot unplug %1$s device with PCI guest address: "
-msgid ""
-"cannot hot unplug %1$s device with multifunction PCI guest address: %2$04x:"
-"%3$02x:%4$02x.%5$d"
+msgid "cannot hot unplug %1$s device with multifunction PCI guest address: "
Another two fixes for xgettext wrt string concatenation
Could you make these 6 fixes in separate patch at the start of this
series, so the remainder of the files are pure changes adding format
positions.
With regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|