]> granicus.if.org Git - neomutt/commitdiff
recvattach.c: Fix plural message "Print tagged attachments?"
authorReis Radomil <reisradomil@fake-box.com>
Tue, 22 May 2018 14:16:12 +0000 (14:16 +0000)
committerRichard Russon <rich@flatcap.org>
Tue, 29 May 2018 03:03:35 +0000 (04:03 +0100)
If messages are tagged, then count them and use the number to pluralise
the phrase "tagged messages" correctly.

recvattach.c

index 2943c2381db51ee7edaba395ce69cb4f25414d0d..2d0e5d6c265ec5812ccf023a9dde066872575165 100644 (file)
@@ -836,10 +836,23 @@ static void print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag,
 
 void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
 {
+  char prompt[SHORT_STRING];
   struct State state = { 0 };
+  int tagmsgcount = 0;
 
-  if (query_quadoption(Print, tag ? _("Print tagged attachment(s)?") :
-                                    _("Print attachment?")) != MUTT_YES)
+  if (tag)
+    for (int i = 0; i < actx->idxlen; i++)
+      if (actx->idx[i]->content->tagged)
+        tagmsgcount++;
+
+  snprintf(prompt, sizeof(prompt),
+           /* L10N: Although we now the precise number of tagged messages, we
+              do not show it to the user.  So feel free to use a "generic
+              plural" as plural translation if your language has one. */
+           tag ? ngettext("Print tagged attachment?", "Print %d tagged attachments?", tagmsgcount) :
+                 _("Print attachment?"),
+           tagmsgcount);
+  if (query_quadoption(Print, prompt) != MUTT_YES)
     return;
 
   if (!AttachSplit)