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

Re: [Outreachy PATCH] checkout: use Q_() for the "... and %d more" message

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 21, 2026, 18:04 UTC
Message-ID
<xmqqv76vnd5h.fsf@gitster.g>
In-Reply-To
<20261021022156.119947-1-tangajoris@gmail.com>
Tanga Joris <tangajoris@gmail.com> writes:
> When leaving orphaned commits behind, "git checkout" ends the list
> with " ... and %d more." using a plain _(), so translators are unable
> to give the correct plural form of the count. Use Q_() so gettext can
> pick it. English string output stays the same.

Is the last sentence worth saying? I am having a hard time imagining who it helps.

Translators of a language that phrases "2 more" and "3 more" the same way now have to translate this placeholder twice. At that cost, however, we help translators of languages that need to phrase "2 more", "3 more", and "5 more" differently.

That is something we may want to say instead.
Show 25 quoted lines
> Signed-off-by: Tanga Joris <tangajoris@gmail.com>
> ---
> The count here is always 2 or more, because when only one commit is
> left over, the suggest_reattach() function lists it instead of printing
> this message. I still used Q_() because some languages, like Polish,
> use different words for 2-4 and for 5 or more.
>
>  builtin/checkout.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 2d575a4f57..49239f029f 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -1085,7 +1085,9 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
>  		if (more == 1)
>  			describe_one_orphan(&sb, last);
>  		else
> -			strbuf_addf(&sb, _(" ... and %d more.\n"), more);
> +			strbuf_addf(&sb, Q_(" ... and %d more.\n",
> +					    " ... and %d more.\n",
> +					    more), more);
>  	}
>  
>  	fprintf(stderr,
Previous: Tanga JorisNext: Tanga Joris
Message 2 of 5 in “checkout: use Q_() for the "... and %d more" message”
  1. checkout: use Q_() for the "... and %d more" messageTanga Joris, Oct 21, 2026
  2. Junio C HamanoOct 21, 2026
  3. Tanga JorisOct 21, 2026
  4. checkout: use Q_() for messages with countsTanga Joris, Oct 22, 2026
  5. Junio C HamanoOct 23, 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.