[Libvir] Re: 0/9: mark error messages as translatable

Daniel Veillard veillard at redhat.com
Thu Mar 27 08:17:19 UTC 2008


On Wed, Mar 26, 2008 at 07:57:18PM +0100, Jim Meyering wrote:
> I've marked many more strings.
> For some of the offending ones (all matching "VAR > MAX_.*"),
> I rewrote the diagnostic to say something more meaningful, and to include
> the actual values via a format like _("translatable message...: %d > %d"),
> e.g. (from 0005):
> 
> -        error (conn, VIR_ERR_RPC, _("maxids > REMOTE_DOMAIN_ID_LIST_MAX"));
> +        errorf (conn, VIR_ERR_RPC,
> +                _("too many remote domain IDs: %d > %d"),
> +                maxids, REMOTE_DOMAIN_ID_LIST_MAX);

  thanks for going though this ! That's both more informative and actually
translatable, way better, thanks again !

> Also, in qemu_conf.c, there were a lot of one-word VIR_ERR_NO_MEMORY
> strings.  I have changed them so that at least the latter part of
> the message ends up being translatable.  Here are two examples:
> 
> diff --git a/src/qemu_conf.c b/src/qemu_conf.c
> index f6ae06b..bafea8c 100644
> --- a/src/qemu_conf.c
> +++ b/src/qemu_conf.c
> @@ -82,7 +82,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
>      strcpy(driver->vncListen, "127.0.0.1");
>      if (!(driver->vncTLSx509certdir = strdup(SYSCONF_DIR "/pki/libvirt-vnc"))) {
>          qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY,
> -                         "vncTLSx509certdir");
> +                         "%s", _("failed to allocate vncTLSx509certdir"));
> 
> ...
> -                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "disk");
> +                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY,
> +                           "%s", _("failed to allocate space for disk string"));
> 
> There are still some strings of the form "function_name: keyword".
> I'm sure someone who cares will go find all of them and replace
> them, as I've done for some of the others.

  yes lot of not very fun work, apply what you have.

> I've left the checking of error() diagnostics disabled,
> because there are a few remaining untranslatable messages,
> and I don't have the energy now to fix them:
> 
>     src/openvz_conf.c:251:  error(conn, VIR_ERR_NO_MEMORY, "vm");
>     src/openvz_conf.c:302:  error(conn, VIR_ERR_NO_MEMORY, "xmlXPathContext");
>     src/openvz_conf.c:316:  error(conn, VIR_ERR_NO_MEMORY, "xmlXPathContext");
>     src/openvz_driver.c:155:error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
>     src/openvz_driver.c:183:error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
>     src/openvz_driver.c:204:error(conn, VIR_ERR_NO_MEMORY, "virDomainPtr");
>     src/openvz_driver.c:262:error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
>     src/openvz_driver.c:306:error(dom->conn, VIR_ERR_INTERNAL_ERROR, "Could not exec " VZLIST);
> 
> If someone is interested, just change the diagnostics, mark them with
> _(...), and when they're all done, uncomment this line in Makefile.maint:
> 
>     # msg_gen_function += error

  okay, maybe we can revive the TODO file, it wasn't updated for ages.

> Likewise for a few other functions.
> Here's the list, from Makefile.maint:
> 
>   # Uncomment the following and run "make syntax-check" to see diagnostics
>   # that are not yet marked for translation, but that need to be rewritten
>   # so that they are translatable.
>   # msg_gen_function += error
>   # msg_gen_function += virXenError
>   # msg_gen_function += testError
>   # msg_gen_function += lxcError
> 
> Much of the first patch you've seen before, but I redid the Makefile.maint
> function list to use += rather than backslash-continued lines
> (slightly more maintainable), and then added a few more functions to the list.

  more readable too,

> I expect to commit this tomorrow morning.

 yes please, 

  thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list