From: Junio C Hamano <gitster@pobox.com>
To: "Raj Ojha via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Raj Ojha <rajojha047@gmail.com>
Subject: Re: [PATCH] describe: use Q_() for pluralization of commit and tag counts
Date: Fri, 16 Oct 2026 08:51:14 -0700 [thread overview]
Message-ID: <xmqqzewdhcel.fsf@gitster.g> (raw)
In-Reply-To: <pull.2257.git.1792058069306.gitgitgadget@gmail.com> (Raj Ojha via GitGitGadget's message of "Thu, 15 Oct 2026 09:54:29 +0000")
"Raj Ojha via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Raj Ojha <rajojha047@gmail.com>
>
> In `describe_commit()`, debug messages print the number of commits
> traversed and the number of candidate tags found using basic `_()`
> localization format strings:
>
> _("traversed %lu commits\n")
> _("found %i tags; gave up search at %s\n")
>
> Because these messages display an integer count of items, using `_()`
> fails to account for languages whose pluralization rules differ from
> English (such as languages with multiple plural forms).
>
> Replace these calls with `Q_()` to allow gettext (`ngettext()`) to choose
> the grammatically appropriate singular or plural string depending on the
> integer count.
>
> Signed-off-by: Raj Ojha <rajojha047@gmail.com>
> ---
Is this convergent evolution or something? The similarity to
https://lore.kernel.org/git/20261013204351.428800-1-antekborowski11@gmail.com/
is striking.
It's not like anybody who sent a change on a piece of code
automatically owns the area to be improved, but we would love to see
more collaboration and a better use of the lore archive to find
similar effort being made before people send patches.
https://lore.kernel.org/git/?q=describe+Q_
> describe: use Q_() for pluralization of commit and tag counts
>
> In describe_commit(), debug messages print the number of commits
> traversed and the number of candidate tags found using basic _()
> localization format strings:
>
> _("traversed %lu commits\n")
> _("found %i tags; gave up search at %s\n")
>
>
> Because these messages display an integer count of items, using _()
> fails to account for languages whose pluralization rules differ from
> English (such as languages with multiple plural forms).
>
> Replace these calls with Q_() to allow gettext (ngettext()) to choose
> the grammatically appropriate singular or plural string depending on the
> integer count.
You do not want to repeat your log message below the three-dash
line. It wastes everybody's time.
> diff --git a/builtin/describe.c b/builtin/describe.c
> index c0abc931a5..1a7317c811 100644
> --- a/builtin/describe.c
> +++ b/builtin/describe.c
> @@ -481,10 +481,16 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
> label_width, _(prio_names[t->name->prio]),
> t->depth, t->name->path);
> }
> - fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
> + fprintf(stderr,
> + Q_("traversed %lu commit\n",
> + "traversed %lu commits\n",
> + seen_commits),
> + seen_commits);
> if (gave_up_on) {
> fprintf(stderr,
> - _("found %i tags; gave up search at %s\n"),
> + Q_("found %i tag; gave up search at %s\n",
> + "found %i tags; gave up search at %s\n",
> + max_candidates),
> max_candidates,
> oid_to_hex(&gave_up_on->object.oid));
> }
Both the log message and patch text look cleanly done.
Thanks.
next prev parent reply other threads:[~2026-10-16 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 9:54 [PATCH] describe: use Q_() for pluralization of commit and tag counts Raj Ojha via GitGitGadget
2026-10-16 15:51 ` Junio C Hamano [this message]
2026-10-17 10:01 ` Oswald Buddenhagen
2026-10-17 16:27 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzewdhcel.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=rajojha047@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox