Avoid the antipattern
printf(n == 1 ? _("one thing") : _("%d things"), n);
instead use
printf(ngettext("one thing", "%d things", n), n);
(note: n has to be passed to ngettext and printf)
Although most Germanic languages (including English) use the singular
form for n=1 and a (single) plural form for all other n (including n=0),
this is not the case in general. An example from the GNU gettext manual
[0] for Polish work plik (file):
1 plik
2,3,4 pliki
5-21 pliko'w
22-24 pliki
25-31 pliko'w
When using numbers in translatable strings, do not choose the translated
plural form in the code. Instead let GNU gettext capability pick the
correct translated plural (provided by a translator) depending on the
number.
[0] https://www.gnu.org/software/gettext/manual/html_chapter/gettext.html#Plural-forms
if (ctx->deleted && !(ctx->magic == MUTT_MAILDIR && MaildirTrash))
{
snprintf(buf, sizeof(buf),
- ctx->deleted == 1 ? _("Purge %d deleted message?") : _("Purge %d deleted messages?"),
+ ngettext("Purge %d deleted message?", "Purge %d deleted messages?", ctx->deleted),
ctx->deleted);
purge = query_quadoption(Delete, buf);
if (purge == MUTT_ABORT)
char buf[SHORT_STRING];
snprintf(buf, sizeof(buf),
- ctx->deleted == 1 ? _("Purge %d deleted message?") : _("Purge %d deleted messages?"),
+ ngettext("Purge %d deleted message?", "Purge %d deleted messages?", ctx->deleted),
ctx->deleted);
purge = query_quadoption(Delete, buf);
if (purge == MUTT_ABORT)