From 411db7ad741a17d42316e1c9d1d31cad99eb6123 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 14 Aug 2007 05:19:57 +0300 Subject: [PATCH] Do not compose strings from translated substrings. Make the life easier for translators by not composing strings from tiny translated parts. --- ChangeLog | 11 +++++++++++ lib/parsehelp.c | 10 ++++++++-- src/archives.c | 21 +++++++++++++-------- src/query.c | 25 +++++++++++++------------ 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56ac3641..85c6880f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-08-14 Guillem Jover + + * lib/parsehelp.c (parseerr): Switch from ternary operator to compose + a string to a conditional call to the function with two different + strings, making life easier for translators. + * src/archives.c (tarobject): Likewise. + * src/query.c (searchoutput): Switch from a loop with two iterations + and ternary operators to compose strings to a conditional with two + sequential calls with different strings, making life easier for + translators. + 2007-08-14 Guillem Jover * dpkg-split/main.c (rerr): Adjust string so that it gets merged by diff --git a/lib/parsehelp.c b/lib/parsehelp.c index 1c181bda..6dc7eaa5 100644 --- a/lib/parsehelp.c +++ b/lib/parsehelp.c @@ -36,8 +36,14 @@ void parseerr va_list al; char buf1[768], buf2[1000], *p, *q; if (file && ferror(file)) ohshite(_("failed to read `%s' at line %d"),filename,lno); - sprintf(buf1, _("%s, in file `%.255s' near line %d"), - warnonly ? _("warning") : _("parse error"), filename, lno); + + if (warnonly) + sprintf(buf1, _("warning, in file `%.255s' near line %d"), + filename, lno); + else + sprintf(buf1, _("parse error, in file `%.255s' near line %d"), + filename, lno); + if (pigp && pigp->name) { sprintf(buf2, _(" package `%.255s'"), pigp->name); strcat(buf1,buf2); diff --git a/src/archives.c b/src/archives.c index 9085e615..df21d277 100644 --- a/src/archives.c +++ b/src/archives.c @@ -405,14 +405,19 @@ int tarobject(struct TarInfo *ti) { if (nifd->namenode->divert && nifd->namenode->divert->camefrom) { divpkg= nifd->namenode->divert->pkg; - forcibleerr(fc_overwritediverted, - _("trying to overwrite `%.250s', which is the " - "diverted version of `%.250s'%.10s%.100s%.10s"), - nifd->namenode->name, - nifd->namenode->divert->camefrom->name, - divpkg ? _(" (package: ") : "", - divpkg ? divpkg->name : "", - divpkg ? ")" : ""); + + if (divpkg) { + forcibleerr(fc_overwritediverted, + _("trying to overwrite `%.250s', which is the " + "diverted version of `%.250s' (package: %.100s)"), + nifd->namenode->name, nifd->namenode->divert->camefrom->name, + divpkg->name); + } else { + forcibleerr(fc_overwritediverted, + _("trying to overwrite `%.250s', which is the " + "diverted version of `%.250s'"), + nifd->namenode->name, nifd->namenode->divert->camefrom->name); + } } usename= namenodetouse(nifd->namenode,tc->pkg)->name + 1; /* Skip the leading `/' */ diff --git a/src/query.c b/src/query.c index ff8d94b7..4a7f9cb5 100644 --- a/src/query.c +++ b/src/query.c @@ -245,18 +245,19 @@ static int searchoutput(struct filenamenode *namenode) { struct filepackages *packageslump; if (namenode->divert) { - for (i=0; i<2; i++) { - if (namenode->divert->pkg) printf(_("diversion by %s"),namenode->divert->pkg->name); - else printf(_("local diversion")); - printf(" %s: %s\n", i ? _("to") : _("from"), - i ? - (namenode->divert->useinstead - ? namenode->divert->useinstead->name - : namenode->name) - : - (namenode->divert->camefrom - ? namenode->divert->camefrom->name - : namenode->name)); + const char *name_from = namenode->divert->camefrom ? + namenode->divert->camefrom->name : namenode->name; + const char *name_to = namenode->divert->useinstead ? + namenode->divert->useinstead->name : namenode->name; + + if (namenode->divert->pkg) { + printf(_("diversion by %s from: %s\n"), + namenode->divert->pkg->name, name_from); + printf(_("diversion by %s to: %s\n"), + namenode->divert->pkg->name, name_to); + } else { + printf(_("local diversion from: %s\n"), name_from); + printf(_("local diversion to: %s\n"), name_to); } } found= 0; -- 2.39.5