From 76a7098407200a986b1d0fce1baaf23a767cc800 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 27 Mar 2008 14:01:59 +0000 Subject: [PATCH] testError: mark most string arguments for translation * Makefile.maint (msg_gen_function): Add testError * src/test.c (testDomainSave, testDomainRestore): Mark strings. (testDomainCoreDump): Likewise. --- ChangeLog | 5 +++++ Makefile.maint | 5 +++-- src/test.c | 30 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19fb54313f..ba51e61a61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ Thu Mar 27 14:36:56 CET 2008 Jim Meyering + testError: mark most string arguments for translation + * Makefile.maint (msg_gen_function): Add testError + * src/test.c (testDomainSave, testDomainRestore): Mark strings. + (testDomainCoreDump): Likewise. + openvzLog: mark its string arguments for translation * Makefile.maint (msg_gen_function): Add openvzLog. * src/openvz_conf.c (openvzAssignVMDef, openvzParseXML): Mark strings. diff --git a/Makefile.maint b/Makefile.maint index 55a9677392..518e59bf0c 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 f401d7de21..6cf3fdade6 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); }