[RFC PATCH 0/8] Translatable string handling improvements

Peter Krempa posted 8 patches 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1681373548.git.pkrempa@redhat.com
src/util/vircgroupv1.c     | 264 ++++++++++++++++---------------------
src/util/virnetlink.c      |   6 +-
src/vz/vz_driver.c         |   4 +-
tools/virsh-domain-event.c | 223 +++++++++++++++++--------------
tools/vsh.c                |  32 +++--
tools/vsh.h                |   4 +
6 files changed, 274 insertions(+), 259 deletions(-)
[RFC PATCH 0/8] Translatable string handling improvements
Posted by Peter Krempa 1 year, 1 month ago
Many things in libvirt attempt to construct error messages from various
sub-strings which is not translation friednly.

The beginning of the series refactors the cgroup code to avoid this
practice.

The end of this series is an example how the worst offender, virsh event
handling code, can be improved to avoid the bad practice.

I've found most cases using:

 git grep ' _([^"]'

Unfortunateluy the better practice is a bit more verbose, thus RFC.

Peter Krempa (8):
  virCgroupV1GetBlkioIo(Device)Serviced: Refactor extraction of cgroup
    data
  Don't translate strings used with VIR_DEBUG
  virshGraphicsAddressToString: Remove pointless translation
  vshPrint: Add version using 'va_list'
  virsh: event: Introduce virshEventPrintf
  virsh-domain-event: Make 'virshEventTrayChangePrint' translation
    friendly
  virsh-domain-event: Make 'virshEventWatchdogPrint' translation
    friendly
  virsh-domain-event: Make 'virshEventIOError(Reason)Print' translation
    friendly

 src/util/vircgroupv1.c     | 264 ++++++++++++++++---------------------
 src/util/virnetlink.c      |   6 +-
 src/vz/vz_driver.c         |   4 +-
 tools/virsh-domain-event.c | 223 +++++++++++++++++--------------
 tools/vsh.c                |  32 +++--
 tools/vsh.h                |   4 +
 6 files changed, 274 insertions(+), 259 deletions(-)

-- 
2.39.2
Re: [RFC PATCH 0/8] Translatable string handling improvements
Posted by Michal Prívozník 1 year, 1 month ago
On 4/13/23 10:15, Peter Krempa wrote:
> Many things in libvirt attempt to construct error messages from various
> sub-strings which is not translation friednly.
> 
> The beginning of the series refactors the cgroup code to avoid this
> practice.
> 
> The end of this series is an example how the worst offender, virsh event
> handling code, can be improved to avoid the bad practice.
> 
> I've found most cases using:
> 
>  git grep ' _([^"]'
> 
> Unfortunateluy the better practice is a bit more verbose, thus RFC.
> 
> Peter Krempa (8):
>   virCgroupV1GetBlkioIo(Device)Serviced: Refactor extraction of cgroup
>     data
>   Don't translate strings used with VIR_DEBUG
>   virshGraphicsAddressToString: Remove pointless translation
>   vshPrint: Add version using 'va_list'
>   virsh: event: Introduce virshEventPrintf
>   virsh-domain-event: Make 'virshEventTrayChangePrint' translation
>     friendly
>   virsh-domain-event: Make 'virshEventWatchdogPrint' translation
>     friendly
>   virsh-domain-event: Make 'virshEventIOError(Reason)Print' translation
>     friendly
> 
>  src/util/vircgroupv1.c     | 264 ++++++++++++++++---------------------
>  src/util/virnetlink.c      |   6 +-
>  src/vz/vz_driver.c         |   4 +-
>  tools/virsh-domain-event.c | 223 +++++++++++++++++--------------
>  tools/vsh.c                |  32 +++--
>  tools/vsh.h                |   4 +
>  6 files changed, 274 insertions(+), 259 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal