{"thread":{"id":"66542","subject":"[PATCH] describe: use Q_() for pluralization of commit and tag counts","startedAt":"2026-10-15T09:54:29Z","lastAt":"2026-10-17T16:27:05Z","messageCount":4,"participants":["Raj Ojha via GitGitGadget","Junio C Hamano","Oswald Buddenhagen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"555128","messageId":"pull.2257.git.1792058069306.gitgitgadget@gmail.com","threadId":"66542","inReplyTo":null,"subject":"[PATCH] describe: use Q_() for pluralization of commit and tag counts","fromName":"Raj Ojha via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-10-15T09:54:29Z","receivedAt":"2026-10-15T09:54:29Z","isPatch":true,"sender":{"key":"name:Raj Ojha","avatar":null},"body":"From: Raj Ojha <rajojha047@gmail.com>\n\nIn `describe_commit()`, debug messages print the number of commits\ntraversed and the number of candidate tags found using basic `_()`\nlocalization format strings:\n\n    _(\"traversed %lu commits\\n\")\n    _(\"found %i tags; gave up search at %s\\n\")\n\nBecause these messages display an integer count of items, using `_()`\nfails to account for languages whose pluralization rules differ from\nEnglish (such as languages with multiple plural forms).\n\nReplace these calls with `Q_()` to allow gettext (`ngettext()`) to choose\nthe grammatically appropriate singular or plural string depending on the\ninteger count.\n\nSigned-off-by: Raj Ojha <rajojha047@gmail.com>\n---\n    describe: use Q_() for pluralization of commit and tag counts\n    \n    In describe_commit(), debug messages print the number of commits\n    traversed and the number of candidate tags found using basic _()\n    localization format strings:\n    \n    _(\"traversed %lu commits\\n\")\n    _(\"found %i tags; gave up search at %s\\n\")\n    \n    \n    Because these messages display an integer count of items, using _()\n    fails to account for languages whose pluralization rules differ from\n    English (such as languages with multiple plural forms).\n    \n    Replace these calls with Q_() to allow gettext (ngettext()) to choose\n    the grammatically appropriate singular or plural string depending on the\n    integer count.\n    \n    Signed-off-by: Raj Ojha rajojha047@gmail.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2257%2FRajojha-1%2Fdescribe-q-pluralize-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2257/Rajojha-1/describe-q-pluralize-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2257\n\n builtin/describe.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex c0abc931a5..1a7317c811 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -481,10 +481,16 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)\n \t\t\t\tlabel_width, _(prio_names[t->name->prio]),\n \t\t\t\tt->depth, t->name->path);\n \t\t}\n-\t\tfprintf(stderr, _(\"traversed %lu commits\\n\"), seen_commits);\n+\t\tfprintf(stderr,\n+\t\t\tQ_(\"traversed %lu commit\\n\",\n+\t\t\t   \"traversed %lu commits\\n\",\n+\t\t\t   seen_commits),\n+\t\t\tseen_commits);\n \t\tif (gave_up_on) {\n \t\t\tfprintf(stderr,\n-\t\t\t\t_(\"found %i tags; gave up search at %s\\n\"),\n+\t\t\t\tQ_(\"found %i tag; gave up search at %s\\n\",\n+\t\t\t\t   \"found %i tags; gave up search at %s\\n\",\n+\t\t\t\t   max_candidates),\n \t\t\t\tmax_candidates,\n \t\t\t\toid_to_hex(&gave_up_on->object.oid));\n \t\t}\n\nbase-commit: 6de20f6092dcf9bdb1c8efe03db4b70c82b423dd\n-- \ngitgitgadget\n\n"},{"id":"555248","messageId":"xmqqzewdhcel.fsf@gitster.g","threadId":"66542","inReplyTo":"pull.2257.git.1792058069306.gitgitgadget@gmail.com","subject":"Re: [PATCH] describe: use Q_() for pluralization of commit and tag counts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-16T15:51:14Z","receivedAt":"2026-10-16T15:51:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Raj Ojha via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Raj Ojha <rajojha047@gmail.com>\n>\n> In `describe_commit()`, debug messages print the number of commits\n> traversed and the number of candidate tags found using basic `_()`\n> localization format strings:\n>\n>     _(\"traversed %lu commits\\n\")\n>     _(\"found %i tags; gave up search at %s\\n\")\n>\n> Because these messages display an integer count of items, using `_()`\n> fails to account for languages whose pluralization rules differ from\n> English (such as languages with multiple plural forms).\n>\n> Replace these calls with `Q_()` to allow gettext (`ngettext()`) to choose\n> the grammatically appropriate singular or plural string depending on the\n> integer count.\n>\n> Signed-off-by: Raj Ojha <rajojha047@gmail.com>\n> ---\n\nIs this convergent evolution or something?  The similarity to\nhttps://lore.kernel.org/git/20261013204351.428800-1-antekborowski11@gmail.com/\nis striking.\n\nIt's not like anybody who sent a change on a piece of code\nautomatically owns the area to be improved, but we would love to see\nmore collaboration and a better use of the lore archive to find\nsimilar effort being made before people send patches.\n\n  https://lore.kernel.org/git/?q=describe+Q_\n\n\n>     describe: use Q_() for pluralization of commit and tag counts\n>     \n>     In describe_commit(), debug messages print the number of commits\n>     traversed and the number of candidate tags found using basic _()\n>     localization format strings:\n>     \n>     _(\"traversed %lu commits\\n\")\n>     _(\"found %i tags; gave up search at %s\\n\")\n>     \n>     \n>     Because these messages display an integer count of items, using _()\n>     fails to account for languages whose pluralization rules differ from\n>     English (such as languages with multiple plural forms).\n>     \n>     Replace these calls with Q_() to allow gettext (ngettext()) to choose\n>     the grammatically appropriate singular or plural string depending on the\n>     integer count.\n\nYou do not want to repeat your log message below the three-dash\nline.  It wastes everybody's time.\n\n> diff --git a/builtin/describe.c b/builtin/describe.c\n> index c0abc931a5..1a7317c811 100644\n> --- a/builtin/describe.c\n> +++ b/builtin/describe.c\n> @@ -481,10 +481,16 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)\n>  \t\t\t\tlabel_width, _(prio_names[t->name->prio]),\n>  \t\t\t\tt->depth, t->name->path);\n>  \t\t}\n> -\t\tfprintf(stderr, _(\"traversed %lu commits\\n\"), seen_commits);\n> +\t\tfprintf(stderr,\n> +\t\t\tQ_(\"traversed %lu commit\\n\",\n> +\t\t\t   \"traversed %lu commits\\n\",\n> +\t\t\t   seen_commits),\n> +\t\t\tseen_commits);\n>  \t\tif (gave_up_on) {\n>  \t\t\tfprintf(stderr,\n> -\t\t\t\t_(\"found %i tags; gave up search at %s\\n\"),\n> +\t\t\t\tQ_(\"found %i tag; gave up search at %s\\n\",\n> +\t\t\t\t   \"found %i tags; gave up search at %s\\n\",\n> +\t\t\t\t   max_candidates),\n>  \t\t\t\tmax_candidates,\n>  \t\t\t\toid_to_hex(&gave_up_on->object.oid));\n>  \t\t}\n\nBoth the log message and patch text look cleanly done.\n\nThanks.\n\n"},{"id":"555310","messageId":"atNHlNl9mpDqUKb6@ugly.lan","threadId":"66542","inReplyTo":"pull.2257.git.1792058069306.gitgitgadget@gmail.com","subject":"Re: [PATCH] describe: use Q_() for pluralization of commit and tag counts","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2026-10-17T10:01:56Z","receivedAt":"2026-10-17T10:01:56Z","isPatch":true,"sender":{"key":"oswald.buddenhagen@gmx.de","avatar":"https://avatars.githubusercontent.com/u/812380?v=4"},"body":"On Thu, Oct 15, 2026 at 09:54:29AM +0000, Raj Ojha via GitGitGadget wrote:\n>In `describe_commit()`, debug messages print the number of commits\n>traversed and the number of candidate tags found using basic `_()`\n>localization format strings:\n>\n>    _(\"traversed %lu commits\\n\")\n>    _(\"found %i tags; gave up search at %s\\n\")\n>\ni wonder why _debug_ messages are i18n'd in the first place? their target audience would usually be the git developers. or is this just a misnomer?\n\n"},{"id":"555329","messageId":"xmqqmrscb8di.fsf@gitster.g","threadId":"66542","inReplyTo":"atNHlNl9mpDqUKb6@ugly.lan","subject":"Re: [PATCH] describe: use Q_() for pluralization of commit and tag counts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-17T16:27:05Z","receivedAt":"2026-10-17T16:27:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:\n\n> On Thu, Oct 15, 2026 at 09:54:29AM +0000, Raj Ojha via GitGitGadget wrote:\n>>In `describe_commit()`, debug messages print the number of commits\n>>traversed and the number of candidate tags found using basic `_()`\n>>localization format strings:\n>>\n>>    _(\"traversed %lu commits\\n\")\n>>    _(\"found %i tags; gave up search at %s\\n\")\n>>\n> i wonder why _debug_ messages are i18n'd in the first place? their \n> target audience would usually be the git developers. or is this just a \n> misnomer?\n\nFunny that great minds think alike.\n\n  https://lore.kernel.org/git/20261014092923.GA1344504@coredump.intra.peff.net/\n\nwhich led to\n\n  https://lore.kernel.org/git/20261016185418.162998-1-antekborowski11@gmail.com/\n\n;-)\n\n"}]}