]> granicus.if.org Git - neomutt/commitdiff
I18N: handler.c: Pass the complete string to the translator
authorReis Radomil <reisradomil@fake-box.com>
Sun, 22 Apr 2018 04:16:03 +0000 (04:16 +0000)
committerRichard Russon <rich@flatcap.org>
Tue, 24 Apr 2018 20:31:01 +0000 (21:31 +0100)
Pass the complete string to the translator instead of chopping it into
pieces and translate every piece.

handler.c

index 2a7deeb75666895c0e12b43d323387ac2e269d8e..b8a98d07c2dd6e5e950a4558684e5ac22247d44e 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1955,24 +1955,50 @@ int mutt_body_handler(struct Body *b, struct State *s)
   else if ((s->flags & MUTT_DISPLAY) || (b->disposition == DISPATTACH && !OptViewAttach &&
                                          HonorDisposition && (plaintext || handler)))
   {
-    state_mark_attach(s);
-    if (HonorDisposition && b->disposition == DISPATTACH)
-      fputs(_("[-- This is an attachment "), s->fpout);
-    else
-      state_printf(s, _("[-- %s/%s is unsupported "), TYPE(b), b->subtype);
+    const char *str = NULL;
+    char keystroke[SHORT_STRING];
+    keystroke[0] = '\0';
+
     if (!OptViewAttach)
     {
-      char keystroke[SHORT_STRING];
-
       if (km_expand_key(keystroke, sizeof(keystroke),
                         km_find_func(MENU_PAGER, OP_VIEW_ATTACHMENTS)))
       {
-        fprintf(s->fpout, _("(use '%s' to view this part)"), keystroke);
+        if (HonorDisposition && b->disposition == DISPATTACH)
+          /* L10N: Caution: Arguments %1$s and %2$s are also defined but should
+             not be used in this translation!
+
+             %3$s expands to a keystroke/key binding, e.g. 'v'.
+           */
+          str = _(
+              "[-- This is an attachment (use '%3$s' to view this part) --]\n");
+        else
+          /* L10N: %s/%s is a MIME type, e.g. "text/plain".
+             The last %s expands to a keystroke/key binding, e.g. 'v'.
+           */
+          str =
+              _("[-- %s/%s is unsupported (use '%s' to view this part) --]\n");
+      }
+      else
+      {
+        if (HonorDisposition && b->disposition == DISPATTACH)
+          str = _("[-- This is an attachment (need 'view-attachments' bound to "
+                  "key!) --]\n");
+        else
+          /* L10N: %s/%s is a MIME type, e.g. "text/plain". */
+          str = _("[-- %s/%s is unsupported (need 'view-attachments' bound to "
+                  "key!) --]\n");
       }
+    }
+    else
+    {
+      if (HonorDisposition && b->disposition == DISPATTACH)
+        str = _("[-- This is an attachment --]\n");
       else
-        fputs(_("(need 'view-attachments' bound to key!)"), s->fpout);
+        /* L10N: %s/%s is a MIME type, e.g. "text/plain". */
+        str = _("[-- %s/%s is unsupported --]\n");
     }
-    fputs(" --]\n", s->fpout);
+    state_printf(s, str, TYPE(b), b->subtype, keystroke);
   }
 
   s->flags = oflags | (s->flags & MUTT_FIRSTDONE);