git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] describe: use Q_() for pluralization of commit and tag counts

From
RGRaj Ojha via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 15, 2026, 09:54 UTC
Message-ID
<pull.2257.git.1792058069306.gitgitgadget@gmail.com>
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>
---
    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.
    
    Signed-off-by: Raj Ojha rajojha047@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2257%2FRajojha-1%2Fdescribe-q-pluralize-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2257/Rajojha-1/describe-q-pluralize-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2257
 builtin/describe.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
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));
 		}

base-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 4 in “describe: use Q_() for pluralization of commit and tag counts”
  1. describe: use Q_() for pluralization of commit and tag countsRaj Ojha via GitGitGadget, Oct 15, 2026
  2. Junio C HamanoOct 16, 2026
  3. Oswald BuddenhagenOct 17, 2026
  4. Junio C HamanoOct 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.