Просмотр исходного кода

Do not compose strings from translated substrings.

Make the life easier for translators by not composing strings from tiny
translated parts.
Guillem Jover лет назад: 19
Родитель
Сommit
411db7ad74
4 измененных файлов с 45 добавлено и 22 удалено
  1. 11 0
      ChangeLog
  2. 8 2
      lib/parsehelp.c
  3. 13 8
      src/archives.c
  4. 13 12
      src/query.c

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2007-08-14  Guillem Jover  <guillem@debian.org>
+
+	* 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  <guillem@debian.org>
 
 	* dpkg-split/main.c (rerr): Adjust string so that it gets merged by

+ 8 - 2
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);

+ 13 - 8
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 `/' */

+ 13 - 12
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;