[Libvir] [PATCH 8/9] testError: mark most string arguments for translation

testError: mark most string arguments for translation Signed-off-by: Jim Meyering <meyering@redhat.com> --- Makefile.maint | 5 +++-- src/test.c | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Makefile.maint b/Makefile.maint index 55a9677..518e59b 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -317,9 +317,10 @@ msg_gen_function += ReportError msg_gen_function += qemudReportError msg_gen_function += openvzLog -# Uncomment this after adjusting remaining diagnostics to be translatable. +# 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 diff --git a/src/test.c b/src/test.c index f401d7d..6cf3fda 100644 --- a/src/test.c +++ b/src/test.c @@ -1307,31 +1307,31 @@ static int testDomainSave(virDomainPtr domain, xml = testDomainDumpXML(domain, 0); if (xml == NULL) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot allocate space for metadata"); + _("cannot allocate space for metadata")); return (-1); } if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot save domain"); + _("cannot save domain")); return (-1); } len = strlen(xml); if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot write header"); + _("cannot write header")); close(fd); return (-1); } if (safewrite(fd, (char*)&len, sizeof(len)) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot write metadata length"); + _("cannot write metadata length")); close(fd); return (-1); } if (safewrite(fd, xml, len) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot write metadata"); + _("cannot write metadata")); free(xml); close(fd); return (-1); @@ -1339,7 +1339,7 @@ static int testDomainSave(virDomainPtr domain, free(xml); if (close(fd) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot save domain data"); + _("cannot save domain data")); close(fd); return (-1); } @@ -1363,30 +1363,30 @@ static int testDomainRestore(virConnectPtr conn, if ((fd = open(path, O_RDONLY)) < 0) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot read domain image"); + _("cannot read domain image")); return (-1); } if (read(fd, magic, sizeof(magic)) != sizeof(magic)) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "incomplete save header"); + _("incomplete save header")); close(fd); return (-1); } if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "mismatched header magic"); + _("mismatched header magic")); close(fd); return (-1); } if (read(fd, (char*)&len, sizeof(len)) != sizeof(len)) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "failed to read metadata length"); + _("failed to read metadata length")); close(fd); return (-1); } if (len < 1 || len > 8192) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "length of metadata out of range"); + _("length of metadata out of range")); close(fd); return (-1); } @@ -1398,7 +1398,7 @@ static int testDomainRestore(virConnectPtr conn, } if (read(fd, xml, len) != len) { testError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, - "incomplete metdata"); + _("incomplete metdata")); close(fd); return (-1); } @@ -1419,18 +1419,18 @@ static int testDomainCoreDump(virDomainPtr domain, if ((fd = open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot save domain core"); + _("cannot save domain core")); return (-1); } if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot write header"); + _("cannot write header")); close(fd); return (-1); } if (close(fd) < 0) { testError(domain->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR, - "cannot save domain data"); + _("cannot save domain data")); close(fd); return (-1); } -- 1.5.5.rc0.22.g467c

On Wed, Mar 26, 2008 at 08:57:56PM +0100, Jim Meyering wrote:
-# Uncomment this after adjusting remaining diagnostics to be translatable. +# 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
Any reason why we don't want these uncommented all the time? +1, simple enough change. 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:
On Wed, Mar 26, 2008 at 08:57:56PM +0100, Jim Meyering wrote:
-# Uncomment this after adjusting remaining diagnostics to be translatable. +# 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
Any reason why we don't want these uncommented all the time?
This is just an interim thing. It's to keep "make syntax-check" from failing, while we wait for someone to find the energy to fix the currently-not-so-translatable diagnostics and mark them. The idea is that anyone who is interested can uncomment a single function name, run "make syntax-check" to see the list of unmarked and untranslatable diagnostics associated with that name, and (with enough fortitude ;-) convert them all to marked-and-translatable strings. Until then, any new unmarked string args to that name are not going to be checked. An alternative is simply to mark the untranslatable strings, but if we do that, they'll probably never be rewritten, and that's not a service to translators or user.
participants (2)
-
Jim Meyering
-
Richard W.M. Jones