[Libvir] many more translatable strings need to be marked

I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable. I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive. Mark many more strings for translation. * Makefile.maint (err_func_re): Add to the list and make it readable. * po/POTFILES.in: Add src/util.c and src/xm_internal.c, and sort. Signed-off-by: Jim Meyering <meyering@redhat.com> --- Makefile.maint | 32 +++++++- po/POTFILES.in | 10 ++- qemud/remote.c | 197 +++++++++++++++++++++++++------------------------ src/storage_backend.c | 2 +- src/util.c | 2 +- src/xm_internal.c | 16 +++-- 6 files changed, 147 insertions(+), 112 deletions(-) diff --git a/Makefile.maint b/Makefile.maint index 92cdf29..14a2ac5 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -299,8 +299,30 @@ sc_two_space_separator_in_usage: echo "$(ME): an option and its description"; \ 1>&2; exit 1; } || : -err_func_re = \ -(DISABLE_fprintf|qemudLog|(xmlRpc|vir(Xend|XML|Hash|Conf|Test|LibConn|StorageReport))Error) +msg_gen_function = \ + DISABLE_fprintf \ + virXendError \ + virXMLError \ + virHashError \ + virConfError \ + virTestError \ + virLibConnError \ + virStorageReportError \ + virxmlRpcError \ + xenXMError \ + virXenError \ + ReportError \ + testError \ + virLog \ + qemudLog \ + openvzLog \ + virStorageLog \ + qemudReportError \ + remoteDispatchError \ + error + +func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|') +func_re := ($(func_or)) # Look for diagnostics that aren't marked for translation. # This won't find any for which error's format string is on a separate line. @@ -309,12 +331,12 @@ err_func_re = \ # "%s", _("no storage vol w..." sc_unmarked_diagnostics: @grep -nE \ - '\<(vshError|error) \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \ + '\<$(func_re) \([^"]*"[^"]*[a-z]{3}' $$($(CVS_LIST_EXCEPT)) \ | grep -v '_''(' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : - @{ grep -nE '\<$(err_func_re) *\(.*;$$' $$($(CVS_LIST_EXCEPT)); \ - grep -A1 -nE '\<$(err_func_re) *\(.*,$$' $$($(CVS_LIST_EXCEPT)); } \ + @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(CVS_LIST_EXCEPT)); \ + grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(CVS_LIST_EXCEPT)); } \ | sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \ | grep '[ ]"' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ diff --git a/po/POTFILES.in b/po/POTFILES.in index 0aafd2e..b619aa2 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,6 @@ gnulib/lib/gai_strerror.c -qemud/remote.c qemud/qemud.c +qemud/remote.c src/conf.c src/console.c src/hash.c @@ -10,20 +10,22 @@ src/proxy_internal.c src/qemu_conf.c src/qemu_driver.c src/remote_internal.c +src/sexpr.c src/storage_backend.c +src/storage_backend_disk.c src/storage_backend_fs.c -src/storage_backend_logical.c src/storage_backend_iscsi.c -src/storage_backend_disk.c +src/storage_backend_logical.c src/storage_conf.c src/storage_driver.c -src/sexpr.c src/test.c +src/util.c src/uuid.c src/virsh.c src/virterror.c src/xen_internal.c src/xend_internal.c +src/xm_internal.c src/xml.c src/xmlrpc.c src/xs_internal.c diff --git a/qemud/remote.c b/qemud/remote.c index 014fe65..a8f8eb4 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -102,32 +102,34 @@ remoteDispatchClientRequest (struct qemud_server *server, xdrmem_create (&xdr, client->buffer, client->bufferLength, XDR_DECODE); if (!xdr_remote_message_header (&xdr, &req)) { - remoteDispatchError (client, NULL, "xdr_remote_message_header"); + remoteDispatchError (client, NULL, "%s", _("xdr_remote_message_header")); xdr_destroy (&xdr); return; } /* Check version, etc. */ if (req.prog != REMOTE_PROGRAM) { - remoteDispatchError (client, &req, "program mismatch (actual %x, expected %x)", + remoteDispatchError (client, &req, + _("program mismatch (actual %x, expected %x)"), req.prog, REMOTE_PROGRAM); xdr_destroy (&xdr); return; } if (req.vers != REMOTE_PROTOCOL_VERSION) { - remoteDispatchError (client, &req, "version mismatch (actual %x, expected %x)", + remoteDispatchError (client, &req, + _("version mismatch (actual %x, expected %x)"), req.vers, REMOTE_PROTOCOL_VERSION); xdr_destroy (&xdr); return; } if (req.direction != REMOTE_CALL) { - remoteDispatchError (client, &req, "direction (%d) != REMOTE_CALL", + remoteDispatchError (client, &req, _("direction (%d) != REMOTE_CALL"), (int) req.direction); xdr_destroy (&xdr); return; } if (req.status != REMOTE_OK) { - remoteDispatchError (client, &req, "status (%d) != REMOTE_OK", + remoteDispatchError (client, &req, _("status (%d) != REMOTE_OK"), (int) req.status); xdr_destroy (&xdr); return; @@ -143,7 +145,7 @@ remoteDispatchClientRequest (struct qemud_server *server, req.proc != REMOTE_PROC_AUTH_SASL_STEP && req.proc != REMOTE_PROC_AUTH_POLKIT ) { - remoteDispatchError (client, &req, "authentication required"); + remoteDispatchError (client, &req, "%s", _("authentication required")); xdr_destroy (&xdr); return; } @@ -156,7 +158,7 @@ remoteDispatchClientRequest (struct qemud_server *server, #include "remote_dispatch_proc_switch.h" default: - remoteDispatchError (client, &req, "unknown procedure: %d", + remoteDispatchError (client, &req, _("unknown procedure: %d"), req.proc); xdr_destroy (&xdr); return; @@ -164,7 +166,7 @@ remoteDispatchClientRequest (struct qemud_server *server, /* Parse args. */ if (!(*args_filter) (&xdr, args)) { - remoteDispatchError (client, &req, "parse args failed"); + remoteDispatchError (client, &req, "%s", _("parse args failed")); xdr_destroy (&xdr); return; } @@ -179,7 +181,8 @@ remoteDispatchClientRequest (struct qemud_server *server, * an internal error. */ if (rv < -2 || rv > 0) { - remoteDispatchError (client, &req, "internal error - dispatch function returned invalid code %d", rv); + remoteDispatchError (client, &req, + _("internal error - dispatch function returned invalid code %d"), rv); return; } @@ -201,14 +204,14 @@ remoteDispatchClientRequest (struct qemud_server *server, len = 0; /* We'll come back and write this later. */ if (!xdr_int (&xdr, &len)) { - remoteDispatchError (client, &req, "dummy length"); + remoteDispatchError (client, &req, "%s", _("dummy length")); xdr_destroy (&xdr); if (rv == 0) xdr_free (ret_filter, ret); return; } if (!xdr_remote_message_header (&xdr, &rep)) { - remoteDispatchError (client, &req, "serialise reply header"); + remoteDispatchError (client, &req, "%s", _("serialise reply header")); xdr_destroy (&xdr); if (rv == 0) xdr_free (ret_filter, ret); return; @@ -217,7 +220,7 @@ remoteDispatchClientRequest (struct qemud_server *server, /* If OK, serialise return structure, if error serialise error. */ if (rv == 0) { if (!(*ret_filter) (&xdr, ret)) { - remoteDispatchError (client, &req, "serialise return struct"); + remoteDispatchError (client, &req, "%s", _("serialise return struct")); xdr_destroy (&xdr); return; } @@ -272,7 +275,7 @@ remoteDispatchClientRequest (struct qemud_server *server, } if (!xdr_remote_error (&xdr, &error)) { - remoteDispatchError (client, &req, "serialise return error"); + remoteDispatchError (client, &req, "%s", _("serialise return error")); xdr_destroy (&xdr); return; } @@ -281,13 +284,13 @@ remoteDispatchClientRequest (struct qemud_server *server, /* Write the length word. */ len = xdr_getpos (&xdr); if (xdr_setpos (&xdr, 0) == 0) { - remoteDispatchError (client, &req, "xdr_setpos"); + remoteDispatchError (client, &req, "%s", _("xdr_setpos")); xdr_destroy (&xdr); return; } if (!xdr_int (&xdr, &len)) { - remoteDispatchError (client, &req, "serialise return length"); + remoteDispatchError (client, &req, "%s", _("serialise return length")); xdr_destroy (&xdr); return; } @@ -421,7 +424,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED, /* Already opened? */ if (client->conn) { - remoteDispatchError (client, req, "connection already open"); + remoteDispatchError (client, req, "%s", _("connection already open")); return -2; } @@ -447,7 +450,7 @@ remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED, #define CHECK_CONN(client) \ if (!client->conn) { \ - remoteDispatchError (client, req, "connection not open"); \ + remoteDispatchError (client, req, "%s", _("connection not open")); \ return -2; \ } @@ -494,7 +497,7 @@ remoteDispatchGetType (struct qemud_server *server ATTRIBUTE_UNUSED, */ ret->type = strdup (type); if (!ret->type) { - remoteDispatchError (client, req, "out of memory in strdup"); + remoteDispatchError (client, req, "%s", _("out of memory in strdup")); return -2; } @@ -608,7 +611,7 @@ remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUS dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -639,19 +642,19 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT nparams = args->nparams; if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - remoteDispatchError (client, req, "nparams too large"); + remoteDispatchError (client, req, "%s", _("nparams too large")); return -2; } params = malloc (sizeof (*params) * nparams); if (params == NULL) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, "%s", _("out of memory allocating array")); return -2; } dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { free (params); - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -670,7 +673,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT virDomainFree(dom); free (params); remoteDispatchError (client, req, - "out of memory allocating return array"); + "%s", _("out of memory allocating return array")); return -2; } @@ -681,7 +684,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT virDomainFree(dom); free (params); remoteDispatchError (client, req, - "out of memory allocating return array"); + "%s", _("out of memory allocating return array")); return -2; } ret->params.params_val[i].value.type = params[i].type; @@ -701,7 +704,7 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT default: virDomainFree(dom); free (params); - remoteDispatchError (client, req, "unknown type"); + remoteDispatchError (client, req, "%s", _("unknown type")); return -2; } } @@ -726,12 +729,12 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT nparams = args->params.params_len; if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - remoteDispatchError (client, req, "nparams too large"); + remoteDispatchError (client, req, "%s", _("nparams too large")); return -2; } params = malloc (sizeof (*params) * nparams); if (params == NULL) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, "%s", _("out of memory allocating array")); return -2; } @@ -760,7 +763,7 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { free (params); - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -786,7 +789,7 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } path = args->path; @@ -817,7 +820,7 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } path = args->path; @@ -849,7 +852,7 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -873,7 +876,7 @@ remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -935,7 +938,7 @@ remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -957,7 +960,7 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -982,7 +985,7 @@ remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1008,7 +1011,7 @@ remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1033,7 +1036,7 @@ remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1065,7 +1068,7 @@ remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1090,7 +1093,7 @@ remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1115,7 +1118,7 @@ remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1144,19 +1147,19 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } if (args->maxinfo > REMOTE_VCPUINFO_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "maxinfo > REMOTE_VCPUINFO_MAX"); + remoteDispatchError (client, req, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX")); return -2; } if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "maxinfo * maplen > REMOTE_CPUMAPS_MAX"); + remoteDispatchError (client, req, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); return -2; } @@ -1244,7 +1247,7 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1293,7 +1296,7 @@ remoteDispatchListDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX")); return -2; } @@ -1390,13 +1393,13 @@ remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) { virDomainFree(dom); - remoteDispatchError (client, req, "cpumap_len > REMOTE_CPUMAP_MAX"); + remoteDispatchError (client, req, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX")); return -2; } @@ -1423,7 +1426,7 @@ remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1462,7 +1465,7 @@ remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1486,7 +1489,7 @@ remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1510,7 +1513,7 @@ remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1534,7 +1537,7 @@ remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1558,7 +1561,7 @@ remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1582,7 +1585,7 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1606,7 +1609,7 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1630,7 +1633,7 @@ remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1654,7 +1657,7 @@ remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1678,7 +1681,7 @@ remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, dom = get_nonnull_domain (client->conn, args->dom); if (dom == NULL) { - remoteDispatchError (client, req, "domain not found"); + remoteDispatchError (client, req, "%s", _("domain not found")); return -2; } @@ -1701,7 +1704,7 @@ remoteDispatchListDefinedNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -1727,7 +1730,7 @@ remoteDispatchListDomains (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) { remoteDispatchError (client, req, - "maxids > REMOTE_DOMAIN_ID_LIST_MAX"); + "%s", _("maxids > REMOTE_DOMAIN_ID_LIST_MAX")); return -2; } @@ -1752,7 +1755,7 @@ remoteDispatchListNetworks (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -1779,7 +1782,7 @@ remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1839,7 +1842,7 @@ remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1863,7 +1866,7 @@ remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1889,7 +1892,7 @@ remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1913,7 +1916,7 @@ remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1975,7 +1978,7 @@ remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -1999,7 +2002,7 @@ remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, net = get_nonnull_network (client->conn, args->net); if (net == NULL) { - remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found")); return -2; } @@ -2090,13 +2093,14 @@ static char *addrToString(struct qemud_client *client, port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { remoteDispatchError(client, req, - "Cannot resolve address %d: %s", err, gai_strerror(err)); + _("Cannot resolve address %d: %s"), + err, gai_strerror(err)); return NULL; } addr = malloc(strlen(host) + 1 + strlen(port) + 1); if (!addr) { - remoteDispatchError(client, req, "cannot allocate address"); + remoteDispatchError(client, req, "%s", _("cannot allocate address")); return NULL; } @@ -2138,7 +2142,8 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED, /* Get local address in form IPADDR:PORT */ salen = sizeof(sa); if (getsockname(client->fd, (struct sockaddr*)&sa, &salen) < 0) { - remoteDispatchError(client, req, "failed to get sock address %d (%s)", + remoteDispatchError(client, req, + _("failed to get sock address %d (%s)"), errno, strerror(errno)); return -2; } @@ -2149,7 +2154,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED, /* Get remote address in form IPADDR:PORT */ salen = sizeof(sa); if (getpeername(client->fd, (struct sockaddr*)&sa, &salen) < 0) { - remoteDispatchError(client, req, "failed to get peer address %d (%s)", + remoteDispatchError(client, req, _("failed to get peer address %d (%s)"), errno, strerror(errno)); free(localAddr); return -2; @@ -2414,7 +2419,8 @@ remoteDispatchAuthSaslStart (struct qemud_server *server, if (serverout) { ret->data.data_val = malloc(serveroutlen); if (!ret->data.data_val) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, + "%s", _("out of memory allocating array")); return -2; } memcpy(ret->data.data_val, serverout, serveroutlen); @@ -2494,7 +2500,8 @@ remoteDispatchAuthSaslStep (struct qemud_server *server, if (serverout) { ret->data.data_val = malloc(serveroutlen); if (!ret->data.data_val) { - remoteDispatchError (client, req, "out of memory allocating array"); + remoteDispatchError (client, req, + "%s", _("out of memory allocating array")); return -2; } memcpy(ret->data.data_val, serverout, serveroutlen); @@ -2738,7 +2745,7 @@ remoteDispatchListDefinedStoragePools (struct qemud_server *server ATTRIBUTE_UNU if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_NETWORK_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX")); return -2; } @@ -2764,7 +2771,7 @@ remoteDispatchListStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED, if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX")); return -2; } @@ -2791,7 +2798,7 @@ remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2851,7 +2858,7 @@ remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2876,7 +2883,7 @@ remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2900,7 +2907,7 @@ remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2924,7 +2931,7 @@ remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2949,7 +2956,7 @@ remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -2980,7 +2987,7 @@ remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3006,7 +3013,7 @@ remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3089,7 +3096,7 @@ remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3113,7 +3120,7 @@ remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3167,13 +3174,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX")); return -2; } pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3202,7 +3209,7 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3233,7 +3240,7 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED, pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } @@ -3259,7 +3266,7 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3284,7 +3291,7 @@ remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3314,7 +3321,7 @@ remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3341,7 +3348,7 @@ remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED, vol = get_nonnull_storage_vol (client->conn, args->vol); if (vol == NULL) { - remoteDispatchError (client, req, "storage_vol not found"); + remoteDispatchError (client, req, "%s", _("storage_vol not found")); return -2; } @@ -3369,7 +3376,7 @@ remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUS pool = get_nonnull_storage_pool (client->conn, args->pool); if (pool == NULL) { - remoteDispatchError (client, req, "storage_pool not found"); + remoteDispatchError (client, req, "%s", _("storage_pool not found")); return -2; } diff --git a/src/storage_backend.c b/src/storage_backend.c index da0f34a..debbce3 100644 --- a/src/storage_backend.c +++ b/src/storage_backend.c @@ -1,5 +1,5 @@ /* - * storage_backend.h: internal storage driver backend contract + * storage_backend.c: internal storage driver backend contract * * Copyright (C) 2007-2008 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange diff --git a/src/util.c b/src/util.c index 4d61540..8943669 100644 --- a/src/util.c +++ b/src/util.c @@ -458,7 +458,7 @@ int virFileLinkPointsTo (const char *checkLink ATTRIBUTE_UNUSED, const char *checkDest ATTRIBUTE_UNUSED) { - virLog ("%s: not implemented", __FUNCTION__); + virLog (_("%s: not implemented"), __FUNCTION__); return 0; } diff --git a/src/xm_internal.c b/src/xm_internal.c index 6b4b4d7..d50ce46 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -434,7 +434,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) { virHashRemoveEntry(configCache, path, NULL); } free(entry); - xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: name"); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, + "%s", _("xenXMConfigCacheRefresh: name")); goto cleanup; } @@ -444,7 +445,8 @@ static int xenXMConfigCacheRefresh (virConnectPtr conn) { if (virHashAddEntry(configCache, entry->filename, entry) < 0) { virConfFree(entry->conf); free(entry); - xenXMError (conn, VIR_ERR_INTERNAL_ERROR, "xenXMConfigCacheRefresh: virHashAddEntry"); + xenXMError (conn, VIR_ERR_INTERNAL_ERROR, + "%s", _("xenXMConfigCacheRefresh: virHashAddEntry")); goto cleanup; } } @@ -1254,21 +1256,23 @@ int xenXMDomainPinVcpu(virDomainPtr domain, return -1; } if (domain->conn->flags & VIR_CONNECT_RO) { - xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "read only connection"); + xenXMError (domain->conn, VIR_ERR_INVALID_ARG, + "%s", _("read only connection")); return -1; } if (domain->id != -1) { - xenXMError (domain->conn, VIR_ERR_INVALID_ARG, "not inactive domain"); + xenXMError (domain->conn, VIR_ERR_INVALID_ARG, + "%s", _("not inactive domain")); return -1; } if (!(filename = virHashLookup(nameConfigMap, domain->name))) { - xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "virHashLookup"); + xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup")); return -1; } if (!(entry = virHashLookup(configCache, filename))) { xenXMError (domain->conn, VIR_ERR_INTERNAL_ERROR, - "can't retrieve config file for domain"); + "%s", _("can't retrieve config file for domain")); return -1; } -- 1.5.4.3.326.g7655e3

On Fri, Feb 29, 2008 at 03:48:18PM +0100, Jim Meyering wrote:
I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable.
I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive.
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators worldwide, and I'm afraid they are gonna be quite annoyed when facing such strings. There is a small limit to automatically forcing eveything into the transaltion system, which is we should avoid pushing there unstranslatable strings, either by human examination (which basically breaks the attempt of automatic checking) or by rewriting all strings to be proper english and not untranalsatable pseudocode. The point too is that this untranslatable pseudocode is probably the right thing to to use, making it an english sentence won't improve user experience much nor make it easier to fix the problem if it appears. Isn't that going a bit too far ?
- remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found"));
Though this kind of errors make sense to translate. What doesn't make sense is that the same string (and actually the same code) is repeated dozens of time, better replace them with a single remoteDispatchNetworkError(client, req) and generate a single translatable string. Maybe all memory errors from the module should be factored too, So I'm afraid the patch goes either a bit too far, or not far enough, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel Veillard <veillard@redhat.com> wrote:
On Fri, Feb 29, 2008 at 03:48:18PM +0100, Jim Meyering wrote:
I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable.
I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive.
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators
I can easily (and possibly automatically) mark such strings with a specially formatted comment saying they are not meant to be translated. gettext tools propagate such comments so that translators will see them, and they won't be bothered. Would you be satisfied simply to add such a comment to messages that are of the form "SYM < SYM" or "SYM > SYM" ?
worldwide, and I'm afraid they are gonna be quite annoyed when facing such strings. There is a small limit to automatically forcing eveything into the transaltion system, which is we should avoid pushing there unstranslatable strings, either by human examination (which basically breaks the attempt of automatic checking) or by rewriting all strings to be proper english and not untranalsatable pseudocode. The point too is that this untranslatable pseudocode is probably the right thing to to use, making it an english sentence won't improve user experience much nor make it easier to fix the problem if it appears.
Isn't that going a bit too far ?
- remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found"));
Though this kind of errors make sense to translate. What doesn't make sense is that the same string (and actually the same code) is repeated dozens of time, better replace them with a single remoteDispatchNetworkError(client, req) and generate a single translatable string.
You could have said the same thing about the change-set that added all of those diagnostics. IMHO, this issue is independent, and need not delay my change. If you're so inclined, would you be interested in taking on the task of factoring out that duplication?

On Fri, Feb 29, 2008 at 04:15:47PM +0100, Jim Meyering wrote:
Daniel Veillard <veillard@redhat.com> wrote:
On Fri, Feb 29, 2008 at 03:48:18PM +0100, Jim Meyering wrote:
I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable.
I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive.
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators
I can easily (and possibly automatically) mark such strings with a specially formatted comment saying they are not meant to be translated. gettext tools propagate such comments so that translators will see them, and they won't be bothered.
Would you be satisfied simply to add such a comment to messages that are of the form "SYM < SYM" or "SYM > SYM" ?
That could be one way, yes But maybe we should consider those as internal errors (which I think they are) and report them as such, the string itself is probably as well left out of gettext entierely (but the error massage saying it was an internal error, that one need localization).
worldwide, and I'm afraid they are gonna be quite annoyed when facing such strings. There is a small limit to automatically forcing eveything into the transaltion system, which is we should avoid pushing there unstranslatable strings, either by human examination (which basically breaks the attempt of automatic checking) or by rewriting all strings to be proper english and not untranalsatable pseudocode. The point too is that this untranslatable pseudocode is probably the right thing to to use, making it an english sentence won't improve user experience much nor make it easier to fix the problem if it appears.
Isn't that going a bit too far ?
- remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found"));
Though this kind of errors make sense to translate. What doesn't make sense is that the same string (and actually the same code) is repeated dozens of time, better replace them with a single remoteDispatchNetworkError(client, req) and generate a single translatable string.
You could have said the same thing about the change-set that added all of those diagnostics.
Oh, sure :-)
IMHO, this issue is independent, and need not delay my change. If you're so inclined, would you be interested in taking on the task of factoring out that duplication?
yeah, I could do that. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel Veillard <veillard@redhat.com> wrote:
On Fri, Feb 29, 2008 at 04:15:47PM +0100, Jim Meyering wrote:
Daniel Veillard <veillard@redhat.com> wrote:
On Fri, Feb 29, 2008 at 03:48:18PM +0100, Jim Meyering wrote:
I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable.
I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive.
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators
I can easily (and possibly automatically) mark such strings with a specially formatted comment saying they are not meant to be translated. gettext tools propagate such comments so that translators will see them, and they won't be bothered.
Would you be satisfied simply to add such a comment to messages that are of the form "SYM < SYM" or "SYM > SYM" ?
That could be one way, yes But maybe we should consider those as internal errors (which I think they are) and report them as such, the string itself is probably as well left out of gettext entierely (but the error massage saying it was an internal error, that one need localization).
I agree that it'd be nice to improve those diagnostics. How about if I mark the existing ones for now, with the proposed added comments? The comments can then serve as a reminder to rewrite them later. /* FIXME: rewrite this diagnostic */ /* TRANSLATORS: no need to translate */

On Fri, Feb 29, 2008 at 04:54:38PM +0100, Jim Meyering wrote:
Daniel Veillard <veillard@redhat.com> wrote:
But maybe we should consider those as internal errors (which I think they are) and report them as such, the string itself is probably as well left out of gettext entierely (but the error massage saying it was an internal error, that one need localization).
I agree that it'd be nice to improve those diagnostics.
How about if I mark the existing ones for now, with the proposed added comments? The comments can then serve as a reminder to rewrite them later.
/* FIXME: rewrite this diagnostic */ /* TRANSLATORS: no need to translate */
Hum, how that comment for the transaltors actually shows up in their tools ? Honnestly I would rather avoid aving the string sent to them if we know they can't do anything. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel Veillard <veillard@redhat.com> wrote:
On Fri, Feb 29, 2008 at 04:54:38PM +0100, Jim Meyering wrote:
Daniel Veillard <veillard@redhat.com> wrote:
But maybe we should consider those as internal errors (which I think they are) and report them as such, the string itself is probably as well left out of gettext entierely (but the error massage saying it was an internal error, that one need localization).
I agree that it'd be nice to improve those diagnostics.
How about if I mark the existing ones for now, with the proposed added comments? The comments can then serve as a reminder to rewrite them later.
/* FIXME: rewrite this diagnostic */ /* TRANSLATORS: no need to translate */
Hum, how that comment for the transaltors actually shows up in their tools ?
xgettext copies comments marked with "TRANSLATORS:" to the *.po files.
Honnestly I would rather avoid aving the string sent to them if we know they can't do anything.
Sure, we'd rather have good diagnostics everywhere, and still be able to automatically check for unmarked diagnostics. I've proposed a compromise that lets us defer the tedious (and low-priority, imho) work of improving diagnostics that are unlikely to be seen. If that is unsatisfactory, can you propose something else?

On Fri, Feb 29, 2008 at 10:02:35AM -0500, Daniel Veillard wrote:
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators worldwide, and I'm afraid they are gonna be quite annoyed when facing such strings. There is a small limit to automatically forcing eveything into the transaltion system, which is we should avoid pushing there unstranslatable strings, either by human examination (which basically breaks the attempt of automatic checking) or by rewriting all strings to be proper english and not untranalsatable pseudocode. The point too is that this untranslatable pseudocode is probably the right thing to to use, making it an english sentence won't improve user experience much nor make it easier to fix the problem if it appears.
So I'm responsible for the above string :-) Some of these, eg. "ret.names.names_len > maxnames" are basically internal errors. You would only get those errors if the remote server was trying to play funny games with you. The error is really "server is broken or is trying to compromise your client", but we need the extra detail in order to debug the issue. Others, such as the one you highlight above ("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX") are not really something that a non-programmer could do much about. In this case it indicates that a hard limit inside the remote protocol would need to be increased in order for the request to succeed -- ie. you'd have to edit remote_protocol.x and rebuild both the client and server and then your client wouldn't be interoperable with a standard server. Can this be meaningfully translated into something an end user can do anything about? And if they're not an end user but a programmer, they'd need to speak English to understand the libvirt source.
Isn't that going a bit too far ?
- remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found"));
Though this kind of errors make sense to translate. What doesn't make sense is that the same string (and actually the same code) is repeated dozens of time, better replace them with a single remoteDispatchNetworkError(client, req) and generate a single translatable string.
I thought xgettext (or whatever it is which generates the .pot file) would combine equal strings? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

"Richard W.M. Jones" <rjones@redhat.com> wrote: ...
- remoteDispatchError (client, req, "network not found"); + remoteDispatchError (client, req, "%s", _("network not found"));
Though this kind of errors make sense to translate. What doesn't make sense is that the same string (and actually the same code) is repeated dozens of time, better replace them with a single remoteDispatchNetworkError(client, req) and generate a single translatable string.
I thought xgettext (or whatever it is which generates the .pot file) would combine equal strings?
It does. And gcc reuses them, too. He's just saying it'd be good to avoid all this duplication in the .c file: which is true, of course: $ git grep 'remoteDis.*domain.not.found'|sort|uniq -c 29 qemud/remote.c: remoteDispatchError (client, req, "%s", _("domain not found")); $ git grep 'remoteDis.*network.not.found'|wc -l 7 $ git grep 'remoteDis.*storage_pool.not.found'|wc -l 14 But it's independent of whether to translate the strings.

On Fri, Feb 29, 2008 at 10:02:35AM -0500, Daniel Veillard wrote:
On Fri, Feb 29, 2008 at 03:48:18PM +0100, Jim Meyering wrote:
I've found many more strings that should be marked for translation. The first part of this change is to add to the list of diagnostic-printing function names in Makefile.maint and to make that list more readable.
I marked some strings, but am leaving the rest, for now. Running "make sc_unmarked_diagnostics" shows over 300 strings remaining to be marked with _(...). However, while marking them is a big step, it's not all. Once they're all marked, then we'll have to go back and with the help of the right build options (--disable-nls and -Wformat -Wformat-security), or just some judicious grepping through your patch, add "%s" before each _("...") string that contains no "%" directive.
While I undertand the point maybe it's pushed a bit too much, or not enough
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) { remoteDispatchError (client, req, - "maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"); + "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
The net effect of soem of those is that strings which are basically untranslatable will be pushed to the small army of benevolent translators worldwide, and I'm afraid they are gonna be quite annoyed when facing such strings.
This is an argument for fixing the error message to be something more useful. eg, "Too many domain names received" Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering
-
Richard W.M. Jones