[libvirt PATCH 00/51] Use permutable format strings in translations

Jiri Denemark posted 51 patches 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1678463799.git.jdenemar@redhat.com
.gitlab-ci.yml                                |   1 +
build-aux/syntax-check.mk                     |   5 +
docs/coding-style.rst                         |  20 +-
po/meson.build                                |   8 +
scripts/check-pot.py                          |  54 ++
src/access/viraccessdriverpolkit.c            |   2 +-
src/access/viraccessmanager.c                 |   4 +-
src/admin/admin_server_dispatch.c             |  10 +-
src/admin/libvirt-admin.c                     |   6 +-
src/bhyve/bhyve_command.c                     |  18 +-
src/bhyve/bhyve_domain.c                      |   2 +-
src/bhyve/bhyve_driver.c                      |  38 +-
src/bhyve/bhyve_firmware.c                    |   4 +-
src/bhyve/bhyve_monitor.c                     |   6 +-
src/bhyve/bhyve_parse_command.c               |  17 +-
src/bhyve/bhyve_process.c                     |  20 +-
src/ch/ch_conf.c                              |   2 +-
src/ch/ch_domain.c                            |   4 +-
src/ch/ch_driver.c                            |  20 +-
src/ch/ch_monitor.c                           |  27 +-
src/ch/ch_process.c                           |   6 +-
src/conf/backup_conf.c                        |  16 +-
src/conf/capabilities.c                       |  21 +-
src/conf/checkpoint_conf.c                    |   8 +-
src/conf/cpu_conf.c                           |  46 +-
src/conf/device_conf.c                        |   2 +-
src/conf/domain_addr.c                        |  79 +-
src/conf/domain_capabilities.c                |   3 +-
src/conf/domain_conf.c                        | 874 ++++++++----------
src/conf/domain_event.c                       |   4 +-
src/conf/domain_postparse.c                   |  30 +-
src/conf/domain_validate.c                    | 138 ++-
src/conf/interface_conf.c                     |  17 +-
src/conf/netdev_bandwidth_conf.c              |  10 +-
src/conf/netdev_vlan_conf.c                   |  10 +-
src/conf/netdev_vport_profile_conf.c          |   2 +-
src/conf/network_conf.c                       | 367 +++-----
src/conf/networkcommon_conf.c                 |  64 +-
src/conf/node_device_conf.c                   | 178 ++--
src/conf/node_device_util.c                   |   6 +-
src/conf/numa_conf.c                          |  67 +-
src/conf/nwfilter_conf.c                      |  23 +-
src/conf/nwfilter_params.c                    |  25 +-
src/conf/object_event.c                       |  10 +-
src/conf/secret_conf.c                        |   8 +-
src/conf/snapshot_conf.c                      |  45 +-
src/conf/storage_adapter_conf.c               |   6 +-
src/conf/storage_conf.c                       |  26 +-
src/conf/storage_encryption_conf.c            |   4 +-
src/conf/storage_source_conf.c                |  15 +-
src/conf/virchrdev.c                          |  13 +-
src/conf/virdomainjob.c                       |  25 +-
src/conf/virdomainmomentobjlist.c             |   8 +-
src/conf/virdomainobjlist.c                   |  18 +-
src/conf/virnetworkobj.c                      |  24 +-
src/conf/virnetworkportdef.c                  |  14 +-
src/conf/virnodedeviceobj.c                   |   9 +-
src/conf/virnwfilterbindingdef.c              |   4 +-
src/conf/virnwfilterbindingobj.c              |   4 +-
src/conf/virnwfilterbindingobjlist.c          |   8 +-
src/conf/virnwfilterobj.c                     |  12 +-
src/conf/virsecretobj.c                       |  22 +-
src/conf/virstorageobj.c                      |  22 +-
src/cpu/cpu.c                                 |  40 +-
src/cpu/cpu_arm.c                             |  23 +-
src/cpu/cpu_map.c                             |   6 +-
src/cpu/cpu_ppc64.c                           |  33 +-
src/cpu/cpu_s390.c                            |   5 +-
src/cpu/cpu_x86.c                             |  68 +-
src/driver.c                                  |   6 +-
src/esx/esx_driver.c                          | 106 +--
src/esx/esx_network_driver.c                  |  21 +-
src/esx/esx_storage_backend_iscsi.c           |   6 +-
src/esx/esx_storage_backend_vmfs.c            |  32 +-
src/esx/esx_storage_driver.c                  |   8 +-
src/esx/esx_stream.c                          |   4 +-
src/esx/esx_util.c                            |  29 +-
src/esx/esx_vi.c                              | 189 ++--
src/esx/esx_vi_types.c                        |  48 +-
src/hyperv/hyperv_driver.c                    |  46 +-
src/hyperv/hyperv_network_driver.c            |   4 +-
src/hyperv/hyperv_util.c                      |   3 +-
src/hyperv/hyperv_wmi.c                       |  43 +-
src/hypervisor/domain_cgroup.c                |   4 +-
src/hypervisor/domain_driver.c                |  20 +-
src/hypervisor/virhostdev.c                   |  53 +-
src/interface/interface_backend_netcf.c       |  50 +-
src/interface/interface_backend_udev.c        | 100 +-
src/internal.h                                |  20 +-
src/libvirt-domain.c                          |  44 +-
src/libvirt-host.c                            |   6 +-
src/libvirt-lxc.c                             |  11 +-
src/libvirt-network.c                         |   8 +-
src/libvirt-nodedev.c                         |   4 +-
src/libvirt-nwfilter.c                        |   2 +-
src/libvirt-qemu.c                            |   4 +-
src/libvirt-secret.c                          |   6 +-
src/libvirt-storage.c                         |  13 +-
src/libvirt.c                                 |  24 +-
src/libxl/libxl_capabilities.c                |   2 +-
src/libxl/libxl_conf.c                        |  61 +-
src/libxl/libxl_domain.c                      |  24 +-
src/libxl/libxl_driver.c                      | 215 +++--
src/libxl/libxl_migration.c                   |   6 +-
src/libxl/xen_common.c                        |  72 +-
src/libxl/xen_xl.c                            |  28 +-
src/libxl/xen_xm.c                            |   4 +-
src/locking/lock_daemon.c                     |  26 +-
src/locking/lock_daemon_dispatch.c            |  10 +-
src/locking/lock_driver_lockd.c               |  12 +-
src/locking/lock_driver_sanlock.c             |  94 +-
src/locking/lock_manager.c                    |   8 +-
src/locking/sanlock_helper.c                  |   6 +-
src/logging/log_cleaner.c                     |   2 +-
src/logging/log_daemon.c                      |  26 +-
src/logging/log_daemon_dispatch.c             |   2 +-
src/logging/log_handler.c                     |   4 +-
src/lxc/lxc_cgroup.c                          |   2 +-
src/lxc/lxc_container.c                       | 114 +--
src/lxc/lxc_controller.c                      |  78 +-
src/lxc/lxc_domain.c                          |   8 +-
src/lxc/lxc_driver.c                          | 104 +--
src/lxc/lxc_fuse.c                            |   4 +-
src/lxc/lxc_hostdev.c                         |   6 +-
src/lxc/lxc_native.c                          |  26 +-
src/lxc/lxc_process.c                         |  38 +-
src/network/bridge_driver.c                   | 188 ++--
src/network/bridge_driver_conf.c              |   2 +-
src/network/bridge_driver_linux.c             |  12 +-
src/network/leaseshelper.c                    |  12 +-
src/node_device/node_device_driver.c          |  37 +-
src/node_device/node_device_udev.c            |  49 +-
src/nwfilter/nwfilter_dhcpsnoop.c             |  67 +-
src/nwfilter/nwfilter_driver.c                |  18 +-
src/nwfilter/nwfilter_ebiptables_driver.c     |  16 +-
src/nwfilter/nwfilter_gentech_driver.c        |  19 +-
src/nwfilter/nwfilter_learnipaddr.c           |   9 +-
src/openvz/openvz_conf.c                      |  29 +-
src/openvz/openvz_driver.c                    |  43 +-
src/qemu/qemu_agent.c                         |  41 +-
src/qemu/qemu_backup.c                        |  12 +-
src/qemu/qemu_block.c                         |  39 +-
src/qemu/qemu_blockjob.c                      |   2 +-
src/qemu/qemu_capabilities.c                  |  50 +-
src/qemu/qemu_cgroup.c                        |   4 +-
src/qemu/qemu_checkpoint.c                    |  19 +-
src/qemu/qemu_command.c                       |  82 +-
src/qemu/qemu_conf.c                          |  75 +-
src/qemu/qemu_dbus.c                          |  12 +-
src/qemu/qemu_domain.c                        | 188 ++--
src/qemu/qemu_domain_address.c                |  26 +-
src/qemu/qemu_domainjob.c                     |   6 +-
src/qemu/qemu_driver.c                        | 428 ++++-----
src/qemu/qemu_extdevice.c                     |   2 +-
src/qemu/qemu_fd.c                            |   2 +-
src/qemu/qemu_firmware.c                      |  42 +-
src/qemu/qemu_hotplug.c                       | 160 ++--
src/qemu/qemu_interface.c                     |   6 +-
src/qemu/qemu_interop_config.c                |   4 +-
src/qemu/qemu_migration.c                     | 105 ++-
src/qemu/qemu_migration_cookie.c              |  34 +-
src/qemu/qemu_migration_params.c              |  18 +-
src/qemu/qemu_monitor.c                       |  30 +-
src/qemu/qemu_monitor_json.c                  |  91 +-
src/qemu/qemu_monitor_text.c                  |   4 +-
src/qemu/qemu_namespace.c                     |  46 +-
src/qemu/qemu_passt.c                         |   2 +-
src/qemu/qemu_process.c                       | 116 ++-
src/qemu/qemu_qapi.c                          |   4 +-
src/qemu/qemu_saveimage.c                     |  30 +-
src/qemu/qemu_slirp.c                         |   6 +-
src/qemu/qemu_snapshot.c                      |  78 +-
src/qemu/qemu_tpm.c                           |  29 +-
src/qemu/qemu_validate.c                      | 317 +++----
src/qemu/qemu_vhost_user.c                    |   8 +-
src/qemu/qemu_vhost_user_gpu.c                |   2 +-
src/qemu/qemu_virtiofs.c                      |  10 +-
src/remote/remote_daemon.c                    |  20 +-
src/remote/remote_daemon_config.c             |   4 +-
src/remote/remote_daemon_dispatch.c           |  75 +-
src/remote/remote_daemon_stream.c             |   4 +-
src/remote/remote_driver.c                    |  88 +-
src/remote/remote_sockets.c                   |   5 +-
src/remote/remote_ssh_helper.c                |  16 +-
src/rpc/gendispatch.pl                        |  10 +-
src/rpc/virkeepalive.c                        |   2 +-
src/rpc/virnetclient.c                        |   4 +-
src/rpc/virnetclientprogram.c                 |  26 +-
src/rpc/virnetclientstream.c                  |   6 +-
src/rpc/virnetdaemon.c                        |   6 +-
src/rpc/virnetlibsshsession.c                 |  57 +-
src/rpc/virnetmessage.c                       |  21 +-
src/rpc/virnetsaslcontext.c                   |  38 +-
src/rpc/virnetserver.c                        |   2 +-
src/rpc/virnetserverclient.c                  |   4 +-
src/rpc/virnetserverprogram.c                 |  12 +-
src/rpc/virnetsocket.c                        |  42 +-
src/rpc/virnetsshsession.c                    |  59 +-
src/rpc/virnettlscontext.c                    |  78 +-
src/secret/secret_driver.c                    |  13 +-
src/security/security_apparmor.c              |  37 +-
src/security/security_dac.c                   |  28 +-
src/security/security_driver.c                |   4 +-
src/security/security_manager.c               |   6 +-
src/security/security_selinux.c               | 114 +--
src/security/security_util.c                  |  16 +-
src/security/virt-aa-helper.c                 |  10 +-
src/storage/parthelper.c                      |   6 +-
src/storage/storage_backend.c                 |   4 +-
src/storage/storage_backend_disk.c            |  20 +-
src/storage/storage_backend_fs.c              |  15 +-
src/storage/storage_backend_gluster.c         |  31 +-
src/storage/storage_backend_iscsi.c           |   6 +-
src/storage/storage_backend_iscsi_direct.c    |  44 +-
src/storage/storage_backend_logical.c         |  19 +-
src/storage/storage_backend_mpath.c           |   2 +-
src/storage/storage_backend_rbd.c             |  87 +-
src/storage/storage_backend_scsi.c            |  17 +-
src/storage/storage_backend_vstorage.c        |   2 +-
src/storage/storage_driver.c                  | 126 +--
src/storage/storage_util.c                    | 176 ++--
src/storage_file/storage_file_backend.c       |   8 +-
src/storage_file/storage_file_backend_fs.c    |   6 +-
.../storage_file_backend_gluster.c            |  16 +-
src/storage_file/storage_file_probe.c         |  13 +-
src/storage_file/storage_source.c             |  36 +-
.../storage_source_backingstore.c             |  47 +-
src/test/test_driver.c                        | 161 ++--
src/util/iohelper.c                           |  10 +-
src/util/viralloc.c                           |   2 +-
src/util/virauth.c                            |   6 +-
src/util/virauthconfig.c                      |   4 +-
src/util/virbitmap.c                          |   4 +-
src/util/virccw.c                             |   2 +-
src/util/vircgroup.c                          |  42 +-
src/util/vircgroupbackend.c                   |   2 +-
src/util/vircgroupbackend.h                   |   4 +-
src/util/vircgroupv1.c                        |  78 +-
src/util/vircgroupv2.c                        |  80 +-
src/util/vircgroupv2devices.c                 |   4 +-
src/util/vircommand.c                         |  38 +-
src/util/virconf.c                            |  40 +-
src/util/vircrypto.c                          |  14 +-
src/util/virdaemon.c                          |   8 +-
src/util/virdevmapper.c                       |   8 +-
src/util/virdnsmasq.c                         |  15 +-
src/util/virerror.c                           | 212 ++---
src/util/virerror.h                           |  14 +-
src/util/vireventthread.c                     |   2 +-
src/util/virfdstream.c                        |  30 +-
src/util/virfile.c                            | 184 ++--
src/util/virfilecache.c                       |   4 +-
src/util/virfirewall.c                        |   4 +-
src/util/virfirewalld.c                       |   6 +-
src/util/virfirmware.c                        |   4 +-
src/util/virgdbus.c                           |   4 +-
src/util/virhash.c                            |   2 +-
src/util/virhook.c                            |   4 +-
src/util/virhostcpu.c                         |  36 +-
src/util/virhostmem.c                         |  32 +-
src/util/virhostuptime.c                      |   4 +-
src/util/viridentity.c                        |  16 +-
src/util/virinitctl.c                         |   6 +-
src/util/viriptables.c                        |   2 +-
src/util/viriscsi.c                           |  16 +-
src/util/virjson.c                            |  24 +-
src/util/virlease.c                           |   4 +-
src/util/virlockspace.c                       |  34 +-
src/util/virlog.c                             |  28 +-
src/util/virmacmap.c                          |   6 +-
src/util/virmdev.c                            |  18 +-
src/util/virmodule.c                          |  10 +-
src/util/virnetdev.c                          | 145 ++-
src/util/virnetdevbandwidth.c                 |   7 +-
src/util/virnetdevbridge.c                    |  64 +-
src/util/virnetdevip.c                        |  28 +-
src/util/virnetdevmacvlan.c                   |   4 +-
src/util/virnetdevmidonet.c                   |   4 +-
src/util/virnetdevopenvswitch.c               |  28 +-
src/util/virnetdevtap.c                       |  24 +-
src/util/virnetdevveth.c                      |   4 +-
src/util/virnetdevvportprofile.c              |  39 +-
src/util/virnetlink.c                         |  14 +-
src/util/virnodesuspend.c                     |   2 +-
src/util/virnuma.c                            |  26 +-
src/util/virnvme.c                            |   6 +-
src/util/virobject.c                          |   6 +-
src/util/virpci.c                             | 108 +--
src/util/virperf.c                            |   8 +-
src/util/virpidfile.c                         |  14 +-
src/util/virpolkit.c                          |   2 +-
src/util/virportallocator.c                   |  10 +-
src/util/virprocess.c                         |  61 +-
src/util/virrandom.c                          |   2 +-
src/util/virresctrl.c                         |  86 +-
src/util/virrotatingfile.c                    |  30 +-
src/util/virscsi.c                            |   6 +-
src/util/virscsihost.c                        |   7 +-
src/util/virscsivhost.c                       |   6 +-
src/util/virsecret.c                          |   5 +-
src/util/virsocketaddr.c                      |  51 +-
src/util/virstoragefile.c                     |   2 +-
src/util/virstring.c                          |   8 +-
src/util/virsysinfo.c                         |  16 +-
src/util/virsystemd.c                         |   2 +-
src/util/virthreadjob.c                       |   4 +-
src/util/virtpm.c                             |  10 +-
src/util/virtypedparam-public.c               |  25 +-
src/util/virtypedparam.c                      |  29 +-
src/util/viruri.c                             |  11 +-
src/util/virusb.c                             |  16 +-
src/util/virutil.c                            |  35 +-
src/util/virvhba.c                            |   7 +-
src/util/virxml.c                             |  72 +-
src/vbox/vbox_XPCOMCGlue.c                    |   6 +-
src/vbox/vbox_common.c                        | 157 ++--
src/vbox/vbox_network.c                       |   2 +-
src/vbox/vbox_snapshot_conf.c                 |  12 +-
src/vbox/vbox_storage.c                       |  20 +-
src/vbox/vbox_tmpl.c                          |  16 +-
src/vmware/vmware_conf.c                      |  16 +-
src/vmware/vmware_driver.c                    |  26 +-
src/vmx/vmx.c                                 | 264 +++---
src/vz/vz_driver.c                            |  32 +-
src/vz/vz_sdk.c                               |  74 +-
src/vz/vz_utils.c                             |  31 +-
src/vz/vz_utils.h                             |   2 +-
tests/virerrortest.c                          |   7 +-
tools/virsh-checkpoint.c                      |  28 +-
tools/virsh-domain-event.c                    |  65 +-
tools/virsh-domain-monitor.c                  |  24 +-
tools/virsh-domain.c                          | 312 +++----
tools/virsh-edit.c                            |   2 +-
tools/virsh-host.c                            |  46 +-
tools/virsh-interface.c                       |  84 +-
tools/virsh-network.c                         |  71 +-
tools/virsh-nodedev.c                         |  62 +-
tools/virsh-nwfilter.c                        |  27 +-
tools/virsh-pool.c                            |  72 +-
tools/virsh-secret.c                          |  22 +-
tools/virsh-snapshot.c                        |  46 +-
tools/virsh-util.c                            |   2 +-
tools/virsh-volume.c                          |  78 +-
tools/virsh.c                                 |  40 +-
tools/virt-admin.c                            |  54 +-
tools/virt-host-validate-bhyve.c              |   4 +-
tools/virt-host-validate-common.c             |   4 +-
tools/virt-host-validate.c                    |   8 +-
tools/virt-login-shell-helper.c               |  22 +-
tools/virt-pki-query-dn.c                     |  12 +-
tools/vsh.c                                   | 138 ++-
tools/vsh.h                                   |   6 +-
352 files changed, 6145 insertions(+), 6762 deletions(-)
create mode 100755 scripts/check-pot.py
[libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year, 1 month ago
See 01/51 for rationale. Enforced by the last two patches of this
series. The rest is quite boring mechanical update, partially done using
a perl oneliner

    perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'

and tuned manually to fix cases not covered by the regexp above and to
merge multiline messages into a single line. I merged only those that
were touched anyway. Some very long messages consisting of several
sentences were merged only partially and split on sentence boundary.

I will also update libvirt.pot once this is pushed.

Also available via

    git fetch git@gitlab.com:jirkade/libvirt.git format-strings

Jiri Denemark (51):
  docs: Document requirements on format strings in translated messages
  access: Update format strings in translated messages
  admin: Update format strings in translated messages
  bhyve: Update format strings in translated messages
  ch: Update format strings in translated messages
  conf/domain_conf: Update format strings in translated messages
  conf/domain_validate: Update format strings in translated messages
  conf/network_conf: Update format strings in translated messages
  conf/node_device_conf: Update format strings in translated messages
  conf: Update format strings in translated messages
  cpu: Update format strings in translated messages
  esx: Update format strings in translated messages
  hyperv: Update format strings in translated messages
  hypervisor: Update format strings in translated messages
  interface: Update format strings in translated messages
  libxl: Update format strings in translated messages
  locking: Update format strings in translated messages
  logging: Update format strings in translated messages
  lxc: Update format strings in translated messages
  network: Update format strings in translated messages
  node_device: Update format strings in translated messages
  nwfilter: Update format strings in translated messages
  openvz: Update format strings in translated messages
  qemu/qemu_command: Update format strings in translated messages
  qemu/qemu_domain: Update format strings in translated messages
  qemu/qemu_driver: Update format strings in translated messages
  qemu/qemu_hotplug: Update format strings in translated messages
  qemu/qemu_migration: Update format strings in translated messages
  qemu/qemu_monitor_json: Update format strings in translated messages
  qemu/qemu_process: Update format strings in translated messages
  qemu/qemu_validate: Update format strings in translated messages
  qemu: Update format strings in translated messages
  remote: Update format strings in translated messages
  rpc: Update format strings in translated messages
  security: Update format strings in translated messages
  secret: Update format strings in translated messages
  storage: Update format strings in translated messages
  storage_file: Update format strings in translated messages
  test: Update format strings in translated messages
  util: Update format strings in translated messages (part 1)
  util: Update format strings in translated messages (part 2)
  util: Update format strings in translated messages (part 3)
  vbox: Update format strings in translated messages
  vmware: Update format strings in translated messages
  vmx: Update format strings in translated messages
  vz: Update format strings in translated messages
  src: Update format strings in translated messages
  tools: Update format strings in translated messages (part 1)
  tools: Update format strings in translated messages (part 2)
  build: Add checks for permutable format strings
  ci: Run libvirt-pot-check in potfile job

 .gitlab-ci.yml                                |   1 +
 build-aux/syntax-check.mk                     |   5 +
 docs/coding-style.rst                         |  20 +-
 po/meson.build                                |   8 +
 scripts/check-pot.py                          |  54 ++
 src/access/viraccessdriverpolkit.c            |   2 +-
 src/access/viraccessmanager.c                 |   4 +-
 src/admin/admin_server_dispatch.c             |  10 +-
 src/admin/libvirt-admin.c                     |   6 +-
 src/bhyve/bhyve_command.c                     |  18 +-
 src/bhyve/bhyve_domain.c                      |   2 +-
 src/bhyve/bhyve_driver.c                      |  38 +-
 src/bhyve/bhyve_firmware.c                    |   4 +-
 src/bhyve/bhyve_monitor.c                     |   6 +-
 src/bhyve/bhyve_parse_command.c               |  17 +-
 src/bhyve/bhyve_process.c                     |  20 +-
 src/ch/ch_conf.c                              |   2 +-
 src/ch/ch_domain.c                            |   4 +-
 src/ch/ch_driver.c                            |  20 +-
 src/ch/ch_monitor.c                           |  27 +-
 src/ch/ch_process.c                           |   6 +-
 src/conf/backup_conf.c                        |  16 +-
 src/conf/capabilities.c                       |  21 +-
 src/conf/checkpoint_conf.c                    |   8 +-
 src/conf/cpu_conf.c                           |  46 +-
 src/conf/device_conf.c                        |   2 +-
 src/conf/domain_addr.c                        |  79 +-
 src/conf/domain_capabilities.c                |   3 +-
 src/conf/domain_conf.c                        | 874 ++++++++----------
 src/conf/domain_event.c                       |   4 +-
 src/conf/domain_postparse.c                   |  30 +-
 src/conf/domain_validate.c                    | 138 ++-
 src/conf/interface_conf.c                     |  17 +-
 src/conf/netdev_bandwidth_conf.c              |  10 +-
 src/conf/netdev_vlan_conf.c                   |  10 +-
 src/conf/netdev_vport_profile_conf.c          |   2 +-
 src/conf/network_conf.c                       | 367 +++-----
 src/conf/networkcommon_conf.c                 |  64 +-
 src/conf/node_device_conf.c                   | 178 ++--
 src/conf/node_device_util.c                   |   6 +-
 src/conf/numa_conf.c                          |  67 +-
 src/conf/nwfilter_conf.c                      |  23 +-
 src/conf/nwfilter_params.c                    |  25 +-
 src/conf/object_event.c                       |  10 +-
 src/conf/secret_conf.c                        |   8 +-
 src/conf/snapshot_conf.c                      |  45 +-
 src/conf/storage_adapter_conf.c               |   6 +-
 src/conf/storage_conf.c                       |  26 +-
 src/conf/storage_encryption_conf.c            |   4 +-
 src/conf/storage_source_conf.c                |  15 +-
 src/conf/virchrdev.c                          |  13 +-
 src/conf/virdomainjob.c                       |  25 +-
 src/conf/virdomainmomentobjlist.c             |   8 +-
 src/conf/virdomainobjlist.c                   |  18 +-
 src/conf/virnetworkobj.c                      |  24 +-
 src/conf/virnetworkportdef.c                  |  14 +-
 src/conf/virnodedeviceobj.c                   |   9 +-
 src/conf/virnwfilterbindingdef.c              |   4 +-
 src/conf/virnwfilterbindingobj.c              |   4 +-
 src/conf/virnwfilterbindingobjlist.c          |   8 +-
 src/conf/virnwfilterobj.c                     |  12 +-
 src/conf/virsecretobj.c                       |  22 +-
 src/conf/virstorageobj.c                      |  22 +-
 src/cpu/cpu.c                                 |  40 +-
 src/cpu/cpu_arm.c                             |  23 +-
 src/cpu/cpu_map.c                             |   6 +-
 src/cpu/cpu_ppc64.c                           |  33 +-
 src/cpu/cpu_s390.c                            |   5 +-
 src/cpu/cpu_x86.c                             |  68 +-
 src/driver.c                                  |   6 +-
 src/esx/esx_driver.c                          | 106 +--
 src/esx/esx_network_driver.c                  |  21 +-
 src/esx/esx_storage_backend_iscsi.c           |   6 +-
 src/esx/esx_storage_backend_vmfs.c            |  32 +-
 src/esx/esx_storage_driver.c                  |   8 +-
 src/esx/esx_stream.c                          |   4 +-
 src/esx/esx_util.c                            |  29 +-
 src/esx/esx_vi.c                              | 189 ++--
 src/esx/esx_vi_types.c                        |  48 +-
 src/hyperv/hyperv_driver.c                    |  46 +-
 src/hyperv/hyperv_network_driver.c            |   4 +-
 src/hyperv/hyperv_util.c                      |   3 +-
 src/hyperv/hyperv_wmi.c                       |  43 +-
 src/hypervisor/domain_cgroup.c                |   4 +-
 src/hypervisor/domain_driver.c                |  20 +-
 src/hypervisor/virhostdev.c                   |  53 +-
 src/interface/interface_backend_netcf.c       |  50 +-
 src/interface/interface_backend_udev.c        | 100 +-
 src/internal.h                                |  20 +-
 src/libvirt-domain.c                          |  44 +-
 src/libvirt-host.c                            |   6 +-
 src/libvirt-lxc.c                             |  11 +-
 src/libvirt-network.c                         |   8 +-
 src/libvirt-nodedev.c                         |   4 +-
 src/libvirt-nwfilter.c                        |   2 +-
 src/libvirt-qemu.c                            |   4 +-
 src/libvirt-secret.c                          |   6 +-
 src/libvirt-storage.c                         |  13 +-
 src/libvirt.c                                 |  24 +-
 src/libxl/libxl_capabilities.c                |   2 +-
 src/libxl/libxl_conf.c                        |  61 +-
 src/libxl/libxl_domain.c                      |  24 +-
 src/libxl/libxl_driver.c                      | 215 +++--
 src/libxl/libxl_migration.c                   |   6 +-
 src/libxl/xen_common.c                        |  72 +-
 src/libxl/xen_xl.c                            |  28 +-
 src/libxl/xen_xm.c                            |   4 +-
 src/locking/lock_daemon.c                     |  26 +-
 src/locking/lock_daemon_dispatch.c            |  10 +-
 src/locking/lock_driver_lockd.c               |  12 +-
 src/locking/lock_driver_sanlock.c             |  94 +-
 src/locking/lock_manager.c                    |   8 +-
 src/locking/sanlock_helper.c                  |   6 +-
 src/logging/log_cleaner.c                     |   2 +-
 src/logging/log_daemon.c                      |  26 +-
 src/logging/log_daemon_dispatch.c             |   2 +-
 src/logging/log_handler.c                     |   4 +-
 src/lxc/lxc_cgroup.c                          |   2 +-
 src/lxc/lxc_container.c                       | 114 +--
 src/lxc/lxc_controller.c                      |  78 +-
 src/lxc/lxc_domain.c                          |   8 +-
 src/lxc/lxc_driver.c                          | 104 +--
 src/lxc/lxc_fuse.c                            |   4 +-
 src/lxc/lxc_hostdev.c                         |   6 +-
 src/lxc/lxc_native.c                          |  26 +-
 src/lxc/lxc_process.c                         |  38 +-
 src/network/bridge_driver.c                   | 188 ++--
 src/network/bridge_driver_conf.c              |   2 +-
 src/network/bridge_driver_linux.c             |  12 +-
 src/network/leaseshelper.c                    |  12 +-
 src/node_device/node_device_driver.c          |  37 +-
 src/node_device/node_device_udev.c            |  49 +-
 src/nwfilter/nwfilter_dhcpsnoop.c             |  67 +-
 src/nwfilter/nwfilter_driver.c                |  18 +-
 src/nwfilter/nwfilter_ebiptables_driver.c     |  16 +-
 src/nwfilter/nwfilter_gentech_driver.c        |  19 +-
 src/nwfilter/nwfilter_learnipaddr.c           |   9 +-
 src/openvz/openvz_conf.c                      |  29 +-
 src/openvz/openvz_driver.c                    |  43 +-
 src/qemu/qemu_agent.c                         |  41 +-
 src/qemu/qemu_backup.c                        |  12 +-
 src/qemu/qemu_block.c                         |  39 +-
 src/qemu/qemu_blockjob.c                      |   2 +-
 src/qemu/qemu_capabilities.c                  |  50 +-
 src/qemu/qemu_cgroup.c                        |   4 +-
 src/qemu/qemu_checkpoint.c                    |  19 +-
 src/qemu/qemu_command.c                       |  82 +-
 src/qemu/qemu_conf.c                          |  75 +-
 src/qemu/qemu_dbus.c                          |  12 +-
 src/qemu/qemu_domain.c                        | 188 ++--
 src/qemu/qemu_domain_address.c                |  26 +-
 src/qemu/qemu_domainjob.c                     |   6 +-
 src/qemu/qemu_driver.c                        | 428 ++++-----
 src/qemu/qemu_extdevice.c                     |   2 +-
 src/qemu/qemu_fd.c                            |   2 +-
 src/qemu/qemu_firmware.c                      |  42 +-
 src/qemu/qemu_hotplug.c                       | 160 ++--
 src/qemu/qemu_interface.c                     |   6 +-
 src/qemu/qemu_interop_config.c                |   4 +-
 src/qemu/qemu_migration.c                     | 105 ++-
 src/qemu/qemu_migration_cookie.c              |  34 +-
 src/qemu/qemu_migration_params.c              |  18 +-
 src/qemu/qemu_monitor.c                       |  30 +-
 src/qemu/qemu_monitor_json.c                  |  91 +-
 src/qemu/qemu_monitor_text.c                  |   4 +-
 src/qemu/qemu_namespace.c                     |  46 +-
 src/qemu/qemu_passt.c                         |   2 +-
 src/qemu/qemu_process.c                       | 116 ++-
 src/qemu/qemu_qapi.c                          |   4 +-
 src/qemu/qemu_saveimage.c                     |  30 +-
 src/qemu/qemu_slirp.c                         |   6 +-
 src/qemu/qemu_snapshot.c                      |  78 +-
 src/qemu/qemu_tpm.c                           |  29 +-
 src/qemu/qemu_validate.c                      | 317 +++----
 src/qemu/qemu_vhost_user.c                    |   8 +-
 src/qemu/qemu_vhost_user_gpu.c                |   2 +-
 src/qemu/qemu_virtiofs.c                      |  10 +-
 src/remote/remote_daemon.c                    |  20 +-
 src/remote/remote_daemon_config.c             |   4 +-
 src/remote/remote_daemon_dispatch.c           |  75 +-
 src/remote/remote_daemon_stream.c             |   4 +-
 src/remote/remote_driver.c                    |  88 +-
 src/remote/remote_sockets.c                   |   5 +-
 src/remote/remote_ssh_helper.c                |  16 +-
 src/rpc/gendispatch.pl                        |  10 +-
 src/rpc/virkeepalive.c                        |   2 +-
 src/rpc/virnetclient.c                        |   4 +-
 src/rpc/virnetclientprogram.c                 |  26 +-
 src/rpc/virnetclientstream.c                  |   6 +-
 src/rpc/virnetdaemon.c                        |   6 +-
 src/rpc/virnetlibsshsession.c                 |  57 +-
 src/rpc/virnetmessage.c                       |  21 +-
 src/rpc/virnetsaslcontext.c                   |  38 +-
 src/rpc/virnetserver.c                        |   2 +-
 src/rpc/virnetserverclient.c                  |   4 +-
 src/rpc/virnetserverprogram.c                 |  12 +-
 src/rpc/virnetsocket.c                        |  42 +-
 src/rpc/virnetsshsession.c                    |  59 +-
 src/rpc/virnettlscontext.c                    |  78 +-
 src/secret/secret_driver.c                    |  13 +-
 src/security/security_apparmor.c              |  37 +-
 src/security/security_dac.c                   |  28 +-
 src/security/security_driver.c                |   4 +-
 src/security/security_manager.c               |   6 +-
 src/security/security_selinux.c               | 114 +--
 src/security/security_util.c                  |  16 +-
 src/security/virt-aa-helper.c                 |  10 +-
 src/storage/parthelper.c                      |   6 +-
 src/storage/storage_backend.c                 |   4 +-
 src/storage/storage_backend_disk.c            |  20 +-
 src/storage/storage_backend_fs.c              |  15 +-
 src/storage/storage_backend_gluster.c         |  31 +-
 src/storage/storage_backend_iscsi.c           |   6 +-
 src/storage/storage_backend_iscsi_direct.c    |  44 +-
 src/storage/storage_backend_logical.c         |  19 +-
 src/storage/storage_backend_mpath.c           |   2 +-
 src/storage/storage_backend_rbd.c             |  87 +-
 src/storage/storage_backend_scsi.c            |  17 +-
 src/storage/storage_backend_vstorage.c        |   2 +-
 src/storage/storage_driver.c                  | 126 +--
 src/storage/storage_util.c                    | 176 ++--
 src/storage_file/storage_file_backend.c       |   8 +-
 src/storage_file/storage_file_backend_fs.c    |   6 +-
 .../storage_file_backend_gluster.c            |  16 +-
 src/storage_file/storage_file_probe.c         |  13 +-
 src/storage_file/storage_source.c             |  36 +-
 .../storage_source_backingstore.c             |  47 +-
 src/test/test_driver.c                        | 161 ++--
 src/util/iohelper.c                           |  10 +-
 src/util/viralloc.c                           |   2 +-
 src/util/virauth.c                            |   6 +-
 src/util/virauthconfig.c                      |   4 +-
 src/util/virbitmap.c                          |   4 +-
 src/util/virccw.c                             |   2 +-
 src/util/vircgroup.c                          |  42 +-
 src/util/vircgroupbackend.c                   |   2 +-
 src/util/vircgroupbackend.h                   |   4 +-
 src/util/vircgroupv1.c                        |  78 +-
 src/util/vircgroupv2.c                        |  80 +-
 src/util/vircgroupv2devices.c                 |   4 +-
 src/util/vircommand.c                         |  38 +-
 src/util/virconf.c                            |  40 +-
 src/util/vircrypto.c                          |  14 +-
 src/util/virdaemon.c                          |   8 +-
 src/util/virdevmapper.c                       |   8 +-
 src/util/virdnsmasq.c                         |  15 +-
 src/util/virerror.c                           | 212 ++---
 src/util/virerror.h                           |  14 +-
 src/util/vireventthread.c                     |   2 +-
 src/util/virfdstream.c                        |  30 +-
 src/util/virfile.c                            | 184 ++--
 src/util/virfilecache.c                       |   4 +-
 src/util/virfirewall.c                        |   4 +-
 src/util/virfirewalld.c                       |   6 +-
 src/util/virfirmware.c                        |   4 +-
 src/util/virgdbus.c                           |   4 +-
 src/util/virhash.c                            |   2 +-
 src/util/virhook.c                            |   4 +-
 src/util/virhostcpu.c                         |  36 +-
 src/util/virhostmem.c                         |  32 +-
 src/util/virhostuptime.c                      |   4 +-
 src/util/viridentity.c                        |  16 +-
 src/util/virinitctl.c                         |   6 +-
 src/util/viriptables.c                        |   2 +-
 src/util/viriscsi.c                           |  16 +-
 src/util/virjson.c                            |  24 +-
 src/util/virlease.c                           |   4 +-
 src/util/virlockspace.c                       |  34 +-
 src/util/virlog.c                             |  28 +-
 src/util/virmacmap.c                          |   6 +-
 src/util/virmdev.c                            |  18 +-
 src/util/virmodule.c                          |  10 +-
 src/util/virnetdev.c                          | 145 ++-
 src/util/virnetdevbandwidth.c                 |   7 +-
 src/util/virnetdevbridge.c                    |  64 +-
 src/util/virnetdevip.c                        |  28 +-
 src/util/virnetdevmacvlan.c                   |   4 +-
 src/util/virnetdevmidonet.c                   |   4 +-
 src/util/virnetdevopenvswitch.c               |  28 +-
 src/util/virnetdevtap.c                       |  24 +-
 src/util/virnetdevveth.c                      |   4 +-
 src/util/virnetdevvportprofile.c              |  39 +-
 src/util/virnetlink.c                         |  14 +-
 src/util/virnodesuspend.c                     |   2 +-
 src/util/virnuma.c                            |  26 +-
 src/util/virnvme.c                            |   6 +-
 src/util/virobject.c                          |   6 +-
 src/util/virpci.c                             | 108 +--
 src/util/virperf.c                            |   8 +-
 src/util/virpidfile.c                         |  14 +-
 src/util/virpolkit.c                          |   2 +-
 src/util/virportallocator.c                   |  10 +-
 src/util/virprocess.c                         |  61 +-
 src/util/virrandom.c                          |   2 +-
 src/util/virresctrl.c                         |  86 +-
 src/util/virrotatingfile.c                    |  30 +-
 src/util/virscsi.c                            |   6 +-
 src/util/virscsihost.c                        |   7 +-
 src/util/virscsivhost.c                       |   6 +-
 src/util/virsecret.c                          |   5 +-
 src/util/virsocketaddr.c                      |  51 +-
 src/util/virstoragefile.c                     |   2 +-
 src/util/virstring.c                          |   8 +-
 src/util/virsysinfo.c                         |  16 +-
 src/util/virsystemd.c                         |   2 +-
 src/util/virthreadjob.c                       |   4 +-
 src/util/virtpm.c                             |  10 +-
 src/util/virtypedparam-public.c               |  25 +-
 src/util/virtypedparam.c                      |  29 +-
 src/util/viruri.c                             |  11 +-
 src/util/virusb.c                             |  16 +-
 src/util/virutil.c                            |  35 +-
 src/util/virvhba.c                            |   7 +-
 src/util/virxml.c                             |  72 +-
 src/vbox/vbox_XPCOMCGlue.c                    |   6 +-
 src/vbox/vbox_common.c                        | 157 ++--
 src/vbox/vbox_network.c                       |   2 +-
 src/vbox/vbox_snapshot_conf.c                 |  12 +-
 src/vbox/vbox_storage.c                       |  20 +-
 src/vbox/vbox_tmpl.c                          |  16 +-
 src/vmware/vmware_conf.c                      |  16 +-
 src/vmware/vmware_driver.c                    |  26 +-
 src/vmx/vmx.c                                 | 264 +++---
 src/vz/vz_driver.c                            |  32 +-
 src/vz/vz_sdk.c                               |  74 +-
 src/vz/vz_utils.c                             |  31 +-
 src/vz/vz_utils.h                             |   2 +-
 tests/virerrortest.c                          |   7 +-
 tools/virsh-checkpoint.c                      |  28 +-
 tools/virsh-domain-event.c                    |  65 +-
 tools/virsh-domain-monitor.c                  |  24 +-
 tools/virsh-domain.c                          | 312 +++----
 tools/virsh-edit.c                            |   2 +-
 tools/virsh-host.c                            |  46 +-
 tools/virsh-interface.c                       |  84 +-
 tools/virsh-network.c                         |  71 +-
 tools/virsh-nodedev.c                         |  62 +-
 tools/virsh-nwfilter.c                        |  27 +-
 tools/virsh-pool.c                            |  72 +-
 tools/virsh-secret.c                          |  22 +-
 tools/virsh-snapshot.c                        |  46 +-
 tools/virsh-util.c                            |   2 +-
 tools/virsh-volume.c                          |  78 +-
 tools/virsh.c                                 |  40 +-
 tools/virt-admin.c                            |  54 +-
 tools/virt-host-validate-bhyve.c              |   4 +-
 tools/virt-host-validate-common.c             |   4 +-
 tools/virt-host-validate.c                    |   8 +-
 tools/virt-login-shell-helper.c               |  22 +-
 tools/virt-pki-query-dn.c                     |  12 +-
 tools/vsh.c                                   | 138 ++-
 tools/vsh.h                                   |   6 +-
 352 files changed, 6145 insertions(+), 6762 deletions(-)
 create mode 100755 scripts/check-pot.py

-- 
2.39.2
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year, 1 month ago
On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> See 01/51 for rationale. Enforced by the last two patches of this
> series. The rest is quite boring mechanical update, partially done using
> a perl oneliner
> 
>     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> 
> and tuned manually to fix cases not covered by the regexp above and to
> merge multiline messages into a single line. I merged only those that
> were touched anyway. Some very long messages consisting of several
> sentences were merged only partially and split on sentence boundary.
> 
> I will also update libvirt.pot once this is pushed.

Are we *100% sure* weblate is going to handle this intelligently.

This will change almost all of the msgid strings in libvirt.pot,
and translations are associatd with msgid strings.

IOW, this risks throwing all our translations away putting us back
to near zero translation coverage, unless weblate is intelligent
enough to map numbered format strings, to non-numbered format
strings, and I'm not convinced that it can do that.

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 :|
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year, 1 month ago
On Fri, Mar 10, 2023 at 16:14:00 +0000, Daniel P. Berrangé wrote:
> On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > See 01/51 for rationale. Enforced by the last two patches of this
> > series. The rest is quite boring mechanical update, partially done using
> > a perl oneliner
> > 
> >     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > 
> > and tuned manually to fix cases not covered by the regexp above and to
> > merge multiline messages into a single line. I merged only those that
> > were touched anyway. Some very long messages consisting of several
> > sentences were merged only partially and split on sentence boundary.
> > 
> > I will also update libvirt.pot once this is pushed.
> 
> Are we *100% sure* weblate is going to handle this intelligently.
> 
> This will change almost all of the msgid strings in libvirt.pot,
> and translations are associatd with msgid strings.
> 
> IOW, this risks throwing all our translations away putting us back
> to near zero translation coverage, unless weblate is intelligent
> enough to map numbered format strings, to non-numbered format
> strings, and I'm not convinced that it can do that.

I don't know is there a way to check this? Technically we should be able
to update the translations as well to make sure we don't lose any work
done by translators. But can that be pushed into weblate somehow (I
guess it must have some kind of import in case you do the translation in
a separate tool).

Jirka
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Ján Tomko 1 year, 1 month ago
On a Friday in 2023, Jiri Denemark wrote:
>On Fri, Mar 10, 2023 at 16:14:00 +0000, Daniel P. Berrangé wrote:
>> On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
>> > See 01/51 for rationale. Enforced by the last two patches of this
>> > series. The rest is quite boring mechanical update, partially done using
>> > a perl oneliner
>> >
>> >     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
>> >
>> > and tuned manually to fix cases not covered by the regexp above and to
>> > merge multiline messages into a single line. I merged only those that
>> > were touched anyway. Some very long messages consisting of several
>> > sentences were merged only partially and split on sentence boundary.
>> >
>> > I will also update libvirt.pot once this is pushed.
>>
>> Are we *100% sure* weblate is going to handle this intelligently.
>>
>> This will change almost all of the msgid strings in libvirt.pot,
>> and translations are associatd with msgid strings.
>>
>> IOW, this risks throwing all our translations away putting us back
>> to near zero translation coverage, unless weblate is intelligent
>> enough to map numbered format strings, to non-numbered format
>> strings, and I'm not convinced that it can do that.
>
>I don't know is there a way to check this?

We could change a small subset of the strings for a start. Preferably
those that are not likely to be exposed to users.

Jano

>Technically we should be able
>to update the translations as well to make sure we don't lose any work
>done by translators. But can that be pushed into weblate somehow (I
>guess it must have some kind of import in case you do the translation in
>a separate tool).
>
>Jirka
>
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year, 1 month ago
On Fri, Mar 10, 2023 at 05:17:21PM +0100, Jiri Denemark wrote:
> On Fri, Mar 10, 2023 at 16:14:00 +0000, Daniel P. Berrangé wrote:
> > On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > > See 01/51 for rationale. Enforced by the last two patches of this
> > > series. The rest is quite boring mechanical update, partially done using
> > > a perl oneliner
> > > 
> > >     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > > 
> > > and tuned manually to fix cases not covered by the regexp above and to
> > > merge multiline messages into a single line. I merged only those that
> > > were touched anyway. Some very long messages consisting of several
> > > sentences were merged only partially and split on sentence boundary.
> > > 
> > > I will also update libvirt.pot once this is pushed.
> > 
> > Are we *100% sure* weblate is going to handle this intelligently.
> > 
> > This will change almost all of the msgid strings in libvirt.pot,
> > and translations are associatd with msgid strings.
> > 
> > IOW, this risks throwing all our translations away putting us back
> > to near zero translation coverage, unless weblate is intelligent
> > enough to map numbered format strings, to non-numbered format
> > strings, and I'm not convinced that it can do that.
> 
> I don't know is there a way to check this? Technically we should be able
> to update the translations as well to make sure we don't lose any work
> done by translators. But can that be pushed into weblate somehow (I
> guess it must have some kind of import in case you do the translation in
> a separate tool).

Yes, there is a mechanism to import that I used when first setting
up weblate, but I can't remember exactly what it was now. I do
recall, however, that it was *immensely* slow and continually
pushed weblate into OOM death due to the large number of string
in libvirt.pot. Took me days to get everything imported :-(


Technically we should really not have to modify the .pot at all,
as it is valid to use numbered format strings in the translation
regardless of whether the .pot uses them.

The main downside is that weblates c-format check is broken so
will complain that the translation format is wrong, despite being
correct. 

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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year, 1 month ago
On Fri, Mar 10, 2023 at 16:29:52 +0000, Daniel P. Berrangé wrote:
> On Fri, Mar 10, 2023 at 05:17:21PM +0100, Jiri Denemark wrote:
> > On Fri, Mar 10, 2023 at 16:14:00 +0000, Daniel P. Berrangé wrote:
> > > On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > > > See 01/51 for rationale. Enforced by the last two patches of this
> > > > series. The rest is quite boring mechanical update, partially done using
> > > > a perl oneliner
> > > > 
> > > >     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > > > 
> > > > and tuned manually to fix cases not covered by the regexp above and to
> > > > merge multiline messages into a single line. I merged only those that
> > > > were touched anyway. Some very long messages consisting of several
> > > > sentences were merged only partially and split on sentence boundary.
> > > > 
> > > > I will also update libvirt.pot once this is pushed.
> > > 
> > > Are we *100% sure* weblate is going to handle this intelligently.
> > > 
> > > This will change almost all of the msgid strings in libvirt.pot,
> > > and translations are associatd with msgid strings.
> > > 
> > > IOW, this risks throwing all our translations away putting us back
> > > to near zero translation coverage, unless weblate is intelligent
> > > enough to map numbered format strings, to non-numbered format
> > > strings, and I'm not convinced that it can do that.
> > 
> > I don't know is there a way to check this? Technically we should be able
> > to update the translations as well to make sure we don't lose any work
> > done by translators. But can that be pushed into weblate somehow (I
> > guess it must have some kind of import in case you do the translation in
> > a separate tool).
> 
> Yes, there is a mechanism to import that I used when first setting
> up weblate, but I can't remember exactly what it was now. I do
> recall, however, that it was *immensely* slow and continually
> pushed weblate into OOM death due to the large number of string
> in libvirt.pot. Took me days to get everything imported :-(
> 
> 
> Technically we should really not have to modify the .pot at all,
> as it is valid to use numbered format strings in the translation
> regardless of whether the .pot uses them.
> 
> The main downside is that weblates c-format check is broken so
> will complain that the translation format is wrong, despite being
> correct. 

Not sure whether the check is disabled by default, but it allows you to
use numbered format strings when msgid doesn't use it. The problem is
that translators cannot just copy&paste a format string to the right
place, they need to invent it. And sometimes they apparently use tools
that do not even allow using numbered format strings when they are not
present in msgid. Which then causes regressions as updates undoing the
correct formatting are pushed via weblate. Which is what happened just
now with https://gitlab.com/libvirt/libvirt/-/merge_requests/232

Jirka
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year, 1 month ago
On Fri, Mar 10, 2023 at 05:43:46PM +0100, Jiri Denemark wrote:
> On Fri, Mar 10, 2023 at 16:29:52 +0000, Daniel P. Berrangé wrote:
> > On Fri, Mar 10, 2023 at 05:17:21PM +0100, Jiri Denemark wrote:
> > > On Fri, Mar 10, 2023 at 16:14:00 +0000, Daniel P. Berrangé wrote:
> > > > On Fri, Mar 10, 2023 at 05:09:16PM +0100, Jiri Denemark wrote:
> > > > > See 01/51 for rationale. Enforced by the last two patches of this
> > > > > series. The rest is quite boring mechanical update, partially done using
> > > > > a perl oneliner
> > > > > 
> > > > >     perl -pe 'for (my $i=1; $i<=12; $i++) { s/(N?_\("[^"]*?%)([^%$ ]*[a-zA-Z][^"]*")/\1$i\$\2/; }'
> > > > > 
> > > > > and tuned manually to fix cases not covered by the regexp above and to
> > > > > merge multiline messages into a single line. I merged only those that
> > > > > were touched anyway. Some very long messages consisting of several
> > > > > sentences were merged only partially and split on sentence boundary.
> > > > > 
> > > > > I will also update libvirt.pot once this is pushed.
> > > > 
> > > > Are we *100% sure* weblate is going to handle this intelligently.
> > > > 
> > > > This will change almost all of the msgid strings in libvirt.pot,
> > > > and translations are associatd with msgid strings.
> > > > 
> > > > IOW, this risks throwing all our translations away putting us back
> > > > to near zero translation coverage, unless weblate is intelligent
> > > > enough to map numbered format strings, to non-numbered format
> > > > strings, and I'm not convinced that it can do that.
> > > 
> > > I don't know is there a way to check this? Technically we should be able
> > > to update the translations as well to make sure we don't lose any work
> > > done by translators. But can that be pushed into weblate somehow (I
> > > guess it must have some kind of import in case you do the translation in
> > > a separate tool).
> > 
> > Yes, there is a mechanism to import that I used when first setting
> > up weblate, but I can't remember exactly what it was now. I do
> > recall, however, that it was *immensely* slow and continually
> > pushed weblate into OOM death due to the large number of string
> > in libvirt.pot. Took me days to get everything imported :-(
> > 
> > 
> > Technically we should really not have to modify the .pot at all,
> > as it is valid to use numbered format strings in the translation
> > regardless of whether the .pot uses them.
> > 
> > The main downside is that weblates c-format check is broken so
> > will complain that the translation format is wrong, despite being
> > correct. 
> 
> Not sure whether the check is disabled by default, but it allows you to
> use numbered format strings when msgid doesn't use it. The problem is
> that translators cannot just copy&paste a format string to the right
> place, they need to invent it. And sometimes they apparently use tools
> that do not even allow using numbered format strings when they are not
> present in msgid. Which then causes regressions as updates undoing the
> correct formatting are pushed via weblate. Which is what happened just
> now with https://gitlab.com/libvirt/libvirt/-/merge_requests/232

The c-format check is currently marked enforcing, and that prevents
translators from confirming strings that have mis-matched formats.
When the string remains in the 'needs editting' state in weblate, it
gets marked as 'fuzzy' in the .po file, and msgfmt will then throw it
away when building the .mo file.

IOW, we should in fact be safe from any crash problems with mis-matched
format strings, despite them appearing in the .po file.

Looking at weblate we have about 100,000 strings in the 'needs editting'
state, which is almost 20% of our total translations in the .po files
not being used. Not all of this is due to c format ordering badness,
in some cases there are formats entirely missing !

We didn't actually have a regression in thue MR 232 because the old
translation with numbered formats was marked fuzzy too, so not being
used.

None the less we need to make this work. The c-format check is good
because it protects us from crashing. Ideally that would be fixed
to permit numbered formats in msgstrs, even when msgid does not use
them.

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.


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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year ago
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
#!/usr/bin/env python3

import sys
import re


# see man 3 printf
reIndex = r"([1-9][0-9]*\$)?"
reFlags = r"([-#0+I']|' ')*"
reWidth = rf"([1-9][0-9]*|\*{reIndex})?"
rePrecision = rf"(\.{reWidth})?"
reLenghtMod = r"(hh|h|l|ll|q|L|j|z|Z|t)?"
reConversion = r"[diouxXeEfFgGaAcspnm%]"
reCFormat = "".join([
    r"%",
    rf"(?P<index>{reIndex})",
    rf"(?P<flags>{reFlags})",
    rf"(?P<width>{reWidth})",
    rf"(?P<precision>{rePrecision})",
    rf"(?P<length>{reLenghtMod})",
    rf"(?P<conversion>{reConversion})"])


def translateFormat(fmt, idx, m):
    groups = m.groupdict()

    if groups["index"] or groups["conversion"] == "%":
        print(f"Ignoring c-format '{fmt}'")
        return idx, fmt

    for field in "width", "precision":
        if "*" in groups[field]:
            groups[field] = f"{groups[field]}{idx}$"
            idx += 1

    newFmt = f"%{idx}${''.join(groups.values())}"
    idx += 1

    return idx, newFmt


def process(ids, strs, fuzzy):
    regex = rf"(.*?)({reCFormat})(.*)"
    fmts = []
    idx = 1

    newIds = []
    for s in ids:
        new = []
        m = re.search(regex, s)
        while m is not None:
            new.append(m.group(1))

            oldFmt = m.group(2)
            idx, newFmt = translateFormat(oldFmt, idx, m)
            fmts.append((oldFmt, newFmt))
            new.append(newFmt)

            s = m.group(m.lastindex)
            m = re.search(regex, s)

        new.append(s)
        newIds.append("".join(new))

    if fuzzy:
        return newIds, strs

    n = 0
    newStrs = []
    for s in strs:
        new = []
        m = re.search(regex, s)
        while m is not None:
            new.append(m.group(1))

            if n < len(fmts) and fmts[n][0] == m.group(2):
                new.append(fmts[n][1])
                n += 1
            else:
                print("Ignoring translation", strs)
                print("              for id", newIds)
                return newIds, strs

            s = m.group(m.lastindex)
            m = re.search(regex, s)

        new.append(s)
        newStrs.append("".join(new))

    return newIds, newStrs


def writeMsg(po, header, strs):
    if len(strs) == 0:
        return

    po.write(header)
    po.write(" ")
    for s in strs:
        po.write('"')
        po.write(s)
        po.write('"\n')


if len(sys.argv) != 2:
    print(f"usage: {sys.argv[0]} PO-FILE", file=sys.stderr)
    sys.exit(1)

pofile = sys.argv[1]

with open(pofile, "r") as po:
    polines = po.readlines()

with open(pofile, "w") as po:
    current = None
    cfmt = False
    fuzzy = False
    ids = []
    strs = []

    for line in polines:
        m = re.search(r'^(([a-z]+) )?"(.*)"', line)
        if m is None:
            if cfmt:
                ids, strs = process(ids, strs, fuzzy)

            writeMsg(po, "msgid", ids)
            writeMsg(po, "msgstr", strs)
            po.write(line)

            cfmt = line.startswith("#,") and " c-format" in line
            fuzzy = line.startswith("#,") and " fuzzy" in line

            current = None
            ids = []
            strs = []
            continue

        if m.group(2):
            current = m.group(2)

        if current == "msgid":
            ids.append(m.group(3))
        elif current == "msgstr":
            strs.append(m.group(3))

    if cfmt:
        ids, strs = process(ids, strs, fuzzy)

    writeMsg(po, "msgid", ids)
    writeMsg(po, "msgstr", strs)
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year ago
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.

Looking at this, I picked a random language (Bengali) and compared
stats:

  https://translate.fedoraproject.org/projects/libvirt/test/bn_IN/

vs

  https://translate.fedoraproject.org/projects/libvirt/libvirt/bn_IN/

Translated strings matches to within 2 words, which is probably
accounted for by being based on different HEAD

Strings with failing checks is massively different, and that is
the fault of 'failing check: C format' - 1300 more failing checks
afterwards.

Comparing

https://translate.fedoraproject.org/browse/libvirt/test/bn_IN/?q=check%3Ac_format&sort_by=source&offset=3

with

https://translate.fedoraproject.org/browse/libvirt/libvirt/bn_IN/?offset=1&q=check%3Ac_format&sort_by=source&checksum=

we can see some obvious missing examples

https://translate.fedoraproject.org/translate/libvirt/test/bn_IN/?checksum=260fc1387343083b&q=check%3Ac_format&sort_by=source

Which is:

 msgid  "active commit requested but '%1$s' is not active"
 msgstr "সংরক্ষণের পুল '%s' সক্রিয় নয়"

looking at po/bn_IN.po I see that this string was already marked as
'fuzzy' before your changes, and thus your script did not try to
convert its format string.

Skipping fuzzy strings makes sense when the number of format
strings is mis-matched. If there's a matching count and matching
ordering, I think we ought to update the msgstr even when fuzzy,
but *keep* it marked fuzzy, so translators can review.

Anyway broadly speaking this script seems to have done the right
thing such that we don't loose translation coverage in the
compiled .mo files. My query is merely about fuzzy strings
which already get excluded from .mo files.

> 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.

Yep, doing it at the start makes sense.

> 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.

NB, even though your script would fix those cases of pre-existng use
of format positions, they'd still be left marked 'fuzzy' so will need
manual review in weblate. At least that is now possible that the
c-format check is no longer failed though.

> 
> Jirka

> #!/usr/bin/env python3
> 
> import sys
> import re
> 
> 
> # see man 3 printf
> reIndex = r"([1-9][0-9]*\$)?"
> reFlags = r"([-#0+I']|' ')*"
> reWidth = rf"([1-9][0-9]*|\*{reIndex})?"
> rePrecision = rf"(\.{reWidth})?"
> reLenghtMod = r"(hh|h|l|ll|q|L|j|z|Z|t)?"
> reConversion = r"[diouxXeEfFgGaAcspnm%]"
> reCFormat = "".join([
>     r"%",
>     rf"(?P<index>{reIndex})",
>     rf"(?P<flags>{reFlags})",
>     rf"(?P<width>{reWidth})",
>     rf"(?P<precision>{rePrecision})",
>     rf"(?P<length>{reLenghtMod})",
>     rf"(?P<conversion>{reConversion})"])
> 
> 
> def translateFormat(fmt, idx, m):
>     groups = m.groupdict()
> 
>     if groups["index"] or groups["conversion"] == "%":
>         print(f"Ignoring c-format '{fmt}'")
>         return idx, fmt
> 
>     for field in "width", "precision":
>         if "*" in groups[field]:
>             groups[field] = f"{groups[field]}{idx}$"
>             idx += 1
> 
>     newFmt = f"%{idx}${''.join(groups.values())}"
>     idx += 1
> 
>     return idx, newFmt
> 
> 
> def process(ids, strs, fuzzy):
>     regex = rf"(.*?)({reCFormat})(.*)"
>     fmts = []
>     idx = 1
> 
>     newIds = []
>     for s in ids:
>         new = []
>         m = re.search(regex, s)
>         while m is not None:
>             new.append(m.group(1))
> 
>             oldFmt = m.group(2)
>             idx, newFmt = translateFormat(oldFmt, idx, m)
>             fmts.append((oldFmt, newFmt))
>             new.append(newFmt)
> 
>             s = m.group(m.lastindex)
>             m = re.search(regex, s)
> 
>         new.append(s)
>         newIds.append("".join(new))
> 
>     if fuzzy:
>         return newIds, strs
> 
>     n = 0
>     newStrs = []
>     for s in strs:
>         new = []
>         m = re.search(regex, s)
>         while m is not None:
>             new.append(m.group(1))
> 
>             if n < len(fmts) and fmts[n][0] == m.group(2):
>                 new.append(fmts[n][1])
>                 n += 1
>             else:
>                 print("Ignoring translation", strs)
>                 print("              for id", newIds)
>                 return newIds, strs
> 
>             s = m.group(m.lastindex)
>             m = re.search(regex, s)
> 
>         new.append(s)
>         newStrs.append("".join(new))
> 
>     return newIds, newStrs
> 
> 
> def writeMsg(po, header, strs):
>     if len(strs) == 0:
>         return
> 
>     po.write(header)
>     po.write(" ")
>     for s in strs:
>         po.write('"')
>         po.write(s)
>         po.write('"\n')
> 
> 
> if len(sys.argv) != 2:
>     print(f"usage: {sys.argv[0]} PO-FILE", file=sys.stderr)
>     sys.exit(1)
> 
> pofile = sys.argv[1]
> 
> with open(pofile, "r") as po:
>     polines = po.readlines()
> 
> with open(pofile, "w") as po:
>     current = None
>     cfmt = False
>     fuzzy = False
>     ids = []
>     strs = []
> 
>     for line in polines:
>         m = re.search(r'^(([a-z]+) )?"(.*)"', line)
>         if m is None:
>             if cfmt:
>                 ids, strs = process(ids, strs, fuzzy)
> 
>             writeMsg(po, "msgid", ids)
>             writeMsg(po, "msgstr", strs)
>             po.write(line)
> 
>             cfmt = line.startswith("#,") and " c-format" in line
>             fuzzy = line.startswith("#,") and " fuzzy" in line
> 
>             current = None
>             ids = []
>             strs = []
>             continue
> 
>         if m.group(2):
>             current = m.group(2)
> 
>         if current == "msgid":
>             ids.append(m.group(3))
>         elif current == "msgstr":
>             strs.append(m.group(3))
> 
>     if cfmt:
>         ids, strs = process(ids, strs, fuzzy)
> 
>     writeMsg(po, "msgid", ids)
>     writeMsg(po, "msgstr", strs)

My attempt at convertnig fuzzy strings involved this diff:

--- /home/berrange/format-strings.py~	2023-03-27 13:29:05.777343030 +0100
+++ /home/berrange/format-strings.py	2023-03-27 13:43:33.950701633 +0100
@@ -62,9 +62,6 @@
         new.append(s)
         newIds.append("".join(new))
 
-    if fuzzy:
-        return newIds, strs
-
     n = 0
     newStrs = []
     for s in strs:
@@ -77,8 +74,9 @@
                 new.append(fmts[n][1])
                 n += 1
             else:
-                print("Ignoring translation", strs)
-                print("              for id", newIds)
+                if not fuzzy:
+                    print("Ignoring translation", strs)
+                    print("              for id", newIds)
                 return newIds, strs
 
             s = m.group(m.lastindex)
@@ -87,6 +85,12 @@
         new.append(s)
         newStrs.append("".join(new))
 
+    if n != len(fmts):
+        if not fuzzy and "".join(strs) != "":
+            print("Ignoring mismatched format count", strs)
+            print("                          for id", newIds)
+        return newIds, strs
+            
     return newIds, newStrs
 
 


With that I believe "Failing check: C format" should match before/after
your changes.

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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year ago
On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> 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.
> 
> Looking at this, I picked a random language (Bengali) and compared
> stats:
> 
>   https://translate.fedoraproject.org/projects/libvirt/test/bn_IN/
> 
> vs
> 
>   https://translate.fedoraproject.org/projects/libvirt/libvirt/bn_IN/
> 
> Translated strings matches to within 2 words, which is probably
> accounted for by being based on different HEAD
> 
> Strings with failing checks is massively different, and that is
> the fault of 'failing check: C format' - 1300 more failing checks
> afterwards.

Oops, my random generator apparently selected wrong language where the
number of 'failing check: C format' issues was significantly lower then
before :-)

Anyway, I did what you suggested and updated the repositories

    https://gitlab.com/jirkade/libvirt/-/commits/format-strings
    https://translate.fedoraproject.org/projects/libvirt/test/

The content is now based on v9.2.0-rc1-8-geb677e3a10 which is just one
commit behind 9.2.0-rc2.

The fixes to whitespace and cpp string concatenation were sent
separately to the list earlier today.

Jirka
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year ago
On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > 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

This looks ok, but I'm wondering if weblate will remember all
our obsolete msgids when we do step 8 ? IOW, will our po files
get the 10,000 current msgids, plus another 5,000 non-position
based msgids marked with '#~ msgid' ?

If so that's going to massively bloat our .po files.

If that's the case, then in between steps 7 and 8, we might need
to rename the current weblate 'libvirt' project to 'libvirt-obsolete'
disconnect it from libvirt.git and then create a new 'libvirt'
project which we populate from the pristine updated .pot and .po
files.


> > > 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.
> > 
> > Looking at this, I picked a random language (Bengali) and compared
> > stats:
> > 
> >   https://translate.fedoraproject.org/projects/libvirt/test/bn_IN/
> > 
> > vs
> > 
> >   https://translate.fedoraproject.org/projects/libvirt/libvirt/bn_IN/
> > 
> > Translated strings matches to within 2 words, which is probably
> > accounted for by being based on different HEAD
> > 
> > Strings with failing checks is massively different, and that is
> > the fault of 'failing check: C format' - 1300 more failing checks
> > afterwards.
> 
> Oops, my random generator apparently selected wrong language where the
> number of 'failing check: C format' issues was significantly lower then
> before :-)
> 
> Anyway, I did what you suggested and updated the repositories
> 
>     https://gitlab.com/jirkade/libvirt/-/commits/format-strings
>     https://translate.fedoraproject.org/projects/libvirt/test/
> 
> The content is now based on v9.2.0-rc1-8-geb677e3a10 which is just one
> commit behind 9.2.0-rc2.

This basically looks good to me. The only minor thing I see is that
projects/libvirt/libvirt has gained some extra translations that
are not in current git master. For example in cs.po there are about
6 fewer failing c-format checks in weblate that are still in cs.po

That will be taken care of when you re-sync the .po files and rerun
the conversion.

So I think this looks ok to go ahead with after release.

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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year ago
On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > 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
> 
> This looks ok, but I'm wondering if weblate will remember all
> our obsolete msgids when we do step 8 ? IOW, will our po files
> get the 10,000 current msgids, plus another 5,000 non-position
> based msgids marked with '#~ msgid' ?

No, apparently it doesn't do so. Looking at the last commit in
https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
update from weblate after all the changes, there's not a single new
"#~ msgid" line added. The overall statistics of the patch is

    46 files changed, 28392 insertions(+), 19137 deletions(-)

and it is caused by weblate (or rather msgmerge) wrapping lines as they
got longer when format strings were updated using the script.

So I don't thing we can just use the existing weblate component in
libvirt project.

> This basically looks good to me. The only minor thing I see is that
> projects/libvirt/libvirt has gained some extra translations that
> are not in current git master. For example in cs.po there are about
> 6 fewer failing c-format checks in weblate that are still in cs.po
> 
> That will be taken care of when you re-sync the .po files and rerun
> the conversion.

Right.

> So I think this looks ok to go ahead with after release.

Great. Thanks for checking. Do you want me to add Reviewed-by lines to
all the ~100 patches with your name or something similar?

Jirka
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year ago
On Fri, Mar 31, 2023 at 05:43:16PM +0200, Jiri Denemark wrote:
> On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> > On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > > 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
> > 
> > This looks ok, but I'm wondering if weblate will remember all
> > our obsolete msgids when we do step 8 ? IOW, will our po files
> > get the 10,000 current msgids, plus another 5,000 non-position
> > based msgids marked with '#~ msgid' ?
> 
> No, apparently it doesn't do so. Looking at the last commit in
> https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
> update from weblate after all the changes, there's not a single new
> "#~ msgid" line added. The overall statistics of the patch is
> 
>     46 files changed, 28392 insertions(+), 19137 deletions(-)
> 
> and it is caused by weblate (or rather msgmerge) wrapping lines as they
> got longer when format strings were updated using the script.

Ok, I wonder where our existing '#~ msgids' lines are coming
from ! 

> > This basically looks good to me. The only minor thing I see is that
> > projects/libvirt/libvirt has gained some extra translations that
> > are not in current git master. For example in cs.po there are about
> > 6 fewer failing c-format checks in weblate that are still in cs.po
> > 
> > That will be taken care of when you re-sync the .po files and rerun
> > the conversion.
> 
> Right.
> 
> > So I think this looks ok to go ahead with after release.
> 
> Great. Thanks for checking. Do you want me to add Reviewed-by lines to
> all the ~100 patches with your name or something similar?

Sure, fine with me.

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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Jiri Denemark 1 year ago
On Fri, Mar 31, 2023 at 16:52:50 +0100, Daniel P. Berrangé wrote:
> On Fri, Mar 31, 2023 at 05:43:16PM +0200, Jiri Denemark wrote:
> > On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> > > On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > > > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > > > 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
> > > 
> > > This looks ok, but I'm wondering if weblate will remember all
> > > our obsolete msgids when we do step 8 ? IOW, will our po files
> > > get the 10,000 current msgids, plus another 5,000 non-position
> > > based msgids marked with '#~ msgid' ?
> > 
> > No, apparently it doesn't do so. Looking at the last commit in
> > https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
> > update from weblate after all the changes, there's not a single new
> > "#~ msgid" line added. The overall statistics of the patch is
> > 
> >     46 files changed, 28392 insertions(+), 19137 deletions(-)
> > 
> > and it is caused by weblate (or rather msgmerge) wrapping lines as they
> > got longer when format strings were updated using the script.
> 
> Ok, I wonder where our existing '#~ msgids' lines are coming
> from ! 

They seem to be added only when a msgid in .po does not exist in .pot
anymore. But since we're pushing both .pot and .po updates at the same
time, msgid strings match.

Jirka
Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year ago
On Fri, Mar 31, 2023 at 05:56:52PM +0200, Jiri Denemark wrote:
> On Fri, Mar 31, 2023 at 16:52:50 +0100, Daniel P. Berrangé wrote:
> > On Fri, Mar 31, 2023 at 05:43:16PM +0200, Jiri Denemark wrote:
> > > On Fri, Mar 31, 2023 at 16:26:42 +0100, Daniel P. Berrangé wrote:
> > > > On Thu, Mar 30, 2023 at 11:37:55AM +0200, Jiri Denemark wrote:
> > > > > On Mon, Mar 27, 2023 at 15:37:34 +0100, Daniel P. Berrangé wrote:
> > > > > > 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
> > > > 
> > > > This looks ok, but I'm wondering if weblate will remember all
> > > > our obsolete msgids when we do step 8 ? IOW, will our po files
> > > > get the 10,000 current msgids, plus another 5,000 non-position
> > > > based msgids marked with '#~ msgid' ?
> > > 
> > > No, apparently it doesn't do so. Looking at the last commit in
> > > https://gitlab.com/jirkade/libvirt/-/commits/format-strings which is an
> > > update from weblate after all the changes, there's not a single new
> > > "#~ msgid" line added. The overall statistics of the patch is
> > > 
> > >     46 files changed, 28392 insertions(+), 19137 deletions(-)
> > > 
> > > and it is caused by weblate (or rather msgmerge) wrapping lines as they
> > > got longer when format strings were updated using the script.
> > 
> > Ok, I wonder where our existing '#~ msgids' lines are coming
> > from ! 
> 
> They seem to be added only when a msgid in .po does not exist in .pot
> anymore. But since we're pushing both .pot and .po updates at the same
> time, msgid strings match.

Ahh ok, that makes sense now.

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 :|

Re: [libvirt PATCH 00/51] Use permutable format strings in translations
Posted by Daniel P. Berrangé 1 year ago
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 :|