{"thread":{"id":"66611","subject":"[Outreachy PATCH] checkout: use Q_() for the \"... and %d more\" message","startedAt":"2026-10-21T02:21:56Z","lastAt":"2026-10-23T17:55:44Z","messageCount":5,"participants":["Tanga Joris","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"555641","messageId":"20261021022156.119947-1-tangajoris@gmail.com","threadId":"66611","inReplyTo":null,"subject":"[Outreachy PATCH] checkout: use Q_() for the \"... and %d more\" message","fromName":"Tanga Joris","fromEmail":"tangajoris@gmail.com","sentAt":"2026-10-21T02:21:56Z","receivedAt":"2026-10-21T02:21:56Z","isPatch":true,"sender":{"key":"tangajoris@gmail.com","avatar":null},"body":"When leaving orphaned commits behind, \"git checkout\" ends the list\nwith \" ... and %d more.\" using a plain _(), so translators are unable\nto give the correct plural form of the count. Use Q_() so gettext can\npick it. English string output stays the same.\n\nSigned-off-by: Tanga Joris <tangajoris@gmail.com>\n---\nThe count here is always 2 or more, because when only one commit is\nleft over, the suggest_reattach() function lists it instead of printing\nthis message. I still used Q_() because some languages, like Polish,\nuse different words for 2-4 and for 5 or more.\n\n builtin/checkout.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 2d575a4f57..49239f029f 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1085,7 +1085,9 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n \t\tif (more == 1)\n \t\t\tdescribe_one_orphan(&sb, last);\n \t\telse\n-\t\t\tstrbuf_addf(&sb, _(\" ... and %d more.\\n\"), more);\n+\t\t\tstrbuf_addf(&sb, Q_(\" ... and %d more.\\n\",\n+\t\t\t\t\t    \" ... and %d more.\\n\",\n+\t\t\t\t\t    more), more);\n \t}\n \n \tfprintf(stderr,\n-- \n2.43.0\n\n\n"},{"id":"555769","messageId":"xmqqv76vnd5h.fsf@gitster.g","threadId":"66611","inReplyTo":"20261021022156.119947-1-tangajoris@gmail.com","subject":"Re: [Outreachy PATCH] checkout: use Q_() for the \"... and %d more\" message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-21T18:04:26Z","receivedAt":"2026-10-21T18:04:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tanga Joris <tangajoris@gmail.com> writes:\n\n> When leaving orphaned commits behind, \"git checkout\" ends the list\n> with \" ... and %d more.\" using a plain _(), so translators are unable\n> to give the correct plural form of the count. Use Q_() so gettext can\n> pick it. English string output stays the same.\n\nIs the last sentence worth saying?  I am having a hard time\nimagining who it helps.\n\nTranslators of a language that phrases \"2 more\" and \"3 more\" the\nsame way now have to translate this placeholder twice.  At that\ncost, however, we help translators of languages that need to phrase\n\"2 more\", \"3 more\", and \"5 more\" differently.\n\nThat is something we may want to say instead.\n\n> Signed-off-by: Tanga Joris <tangajoris@gmail.com>\n> ---\n> The count here is always 2 or more, because when only one commit is\n> left over, the suggest_reattach() function lists it instead of printing\n> this message. I still used Q_() because some languages, like Polish,\n> use different words for 2-4 and for 5 or more.\n>\n>  builtin/checkout.c | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/builtin/checkout.c b/builtin/checkout.c\n> index 2d575a4f57..49239f029f 100644\n> --- a/builtin/checkout.c\n> +++ b/builtin/checkout.c\n> @@ -1085,7 +1085,9 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n>  \t\tif (more == 1)\n>  \t\t\tdescribe_one_orphan(&sb, last);\n>  \t\telse\n> -\t\t\tstrbuf_addf(&sb, _(\" ... and %d more.\\n\"), more);\n> +\t\t\tstrbuf_addf(&sb, Q_(\" ... and %d more.\\n\",\n> +\t\t\t\t\t    \" ... and %d more.\\n\",\n> +\t\t\t\t\t    more), more);\n>  \t}\n>  \n>  \tfprintf(stderr,\n\n"},{"id":"555792","messageId":"CAKrRMNqXi12KS=JehLm9rLQpuZbwFULmZb5tHtZQ-HKTTp=OSw@mail.gmail.com","threadId":"66611","inReplyTo":"xmqqv76vnd5h.fsf@gitster.g","subject":"Re: [Outreachy PATCH] checkout: use Q_() for the \"... and %d more\" message","fromName":"Tanga Joris","fromEmail":"tangajoris@gmail.com","sentAt":"2026-10-21T21:04:23Z","receivedAt":"2026-10-21T21:04:23Z","isPatch":true,"sender":{"key":"tangajoris@gmail.com","avatar":null},"body":"On Wed, 21 Oct 2026 at 21:04, Junio C Hamano <gitster@pobox.com> wrote:\n> Is the last sentence worth saying?  I am having a hard time\n> imagining who it helps.\n>\n> Translators of a language that phrases \"2 more\" and \"3 more\" the\n> same way now have to translate this placeholder twice.  At that\n> cost, however, we help translators of languages that need to phrase\n> \"2 more\", \"3 more\", and \"5 more\" differently.\n>\n> That is something we may want to say instead.\n\nThis makes sense, and thanks for the review and suggestion. I'll use your\nexplanation of the trade-off in place of that sentence in v2. v2 will\nalso convert\n\"only one reference expected, %d given.\" in the same file, following\nTuomas's suggestion in another thread [1].\n\n[1] https://lore.kernel.org/git/20261021110616.Wxkhc%25taahol@utu.fi/\n\nThanks,\nTanga\n\n"},{"id":"555808","messageId":"20261022004834.246892-1-tangajoris@gmail.com","threadId":"66611","inReplyTo":"20261021022156.119947-1-tangajoris@gmail.com","subject":"[Outreachy PATCH v2] checkout: use Q_() for messages with counts","fromName":"Tanga Joris","fromEmail":"tangajoris@gmail.com","sentAt":"2026-10-22T00:48:34Z","receivedAt":"2026-10-22T00:48:34Z","isPatch":true,"sender":{"key":"tangajoris@gmail.com","avatar":null},"body":"Two messages in builtin/checkout.c show a count but are\nmarked with a plain _(), so translators can only give a\nsingle form for them:\n\n- \" ... and %d more.\" at the end of the list of orphaned\n  commits left behind when leaving a detached HEAD, and\n\n- \"only one reference expected, %d given.\" when more than\n  one reference is given before \"--\".\n\nUse Q_() for both. Translators of a language that phrases\n\"2 more\" and \"3 more\" the same way now have to translate\nthese messages twice. At that cost, however, we help\ntranslators of languages that need to phrase \"2 more\",\n\"3 more\", and \"5 more\" differently.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Tanga Joris <tangajoris@gmail.com>\n---\nChanges since v1:\n - Replaced the last sentence of the log message with\n   a better explanation of the trade-off.\n - Also converted \"only one reference expected, %d given.\",\n   as discussed by Tuomas in Mudi's thread.\n\nInterdiff against v1:\n  diff --git a/builtin/checkout.c b/builtin/checkout.c\n  index 49239f029f..91b7c52396 100644\n  --- a/builtin/checkout.c\n  +++ b/builtin/checkout.c\n  @@ -1491,7 +1491,9 @@ static int parse_branchname_arg(int argc, const char **argv,\n   \telse if (dash_dash_pos == 1)\n   \t\thas_dash_dash = 1; /* case (3) or (1) */\n   \telse if (dash_dash_pos >= 2)\n  -\t\tdie(_(\"only one reference expected, %d given.\"), dash_dash_pos);\n  +\t\tdie(Q_(\"only one reference expected, %d given.\",\n  +\t\t       \"only one reference expected, %d given.\",\n  +\t\t       dash_dash_pos), dash_dash_pos);\n   \topts->count_checkout_paths = !opts->quiet && !has_dash_dash;\n   \n   \tif (!strcmp(arg, \"-\"))\n\n builtin/checkout.c | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 2d575a4f57..91b7c52396 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1085,7 +1085,9 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)\n \t\tif (more == 1)\n \t\t\tdescribe_one_orphan(&sb, last);\n \t\telse\n-\t\t\tstrbuf_addf(&sb, _(\" ... and %d more.\\n\"), more);\n+\t\t\tstrbuf_addf(&sb, Q_(\" ... and %d more.\\n\",\n+\t\t\t\t\t    \" ... and %d more.\\n\",\n+\t\t\t\t\t    more), more);\n \t}\n \n \tfprintf(stderr,\n@@ -1489,7 +1491,9 @@ static int parse_branchname_arg(int argc, const char **argv,\n \telse if (dash_dash_pos == 1)\n \t\thas_dash_dash = 1; /* case (3) or (1) */\n \telse if (dash_dash_pos >= 2)\n-\t\tdie(_(\"only one reference expected, %d given.\"), dash_dash_pos);\n+\t\tdie(Q_(\"only one reference expected, %d given.\",\n+\t\t       \"only one reference expected, %d given.\",\n+\t\t       dash_dash_pos), dash_dash_pos);\n \topts->count_checkout_paths = !opts->quiet && !has_dash_dash;\n \n \tif (!strcmp(arg, \"-\"))\n-- \n2.43.0\n\n\n"},{"id":"556086","messageId":"xmqqcxt0713z.fsf@gitster.g","threadId":"66611","inReplyTo":"20261022004834.246892-1-tangajoris@gmail.com","subject":"Re: [Outreachy PATCH v2] checkout: use Q_() for messages with counts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-23T17:55:44Z","receivedAt":"2026-10-23T17:55:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tanga Joris <tangajoris@gmail.com> writes:\n\n>  - Also converted \"only one reference expected, %d given.\",\n>    as discussed by Tuomas in Mudi's thread.\n>\n> Interdiff against v1:\n>   diff --git a/builtin/checkout.c b/builtin/checkout.c\n>   index 49239f029f..91b7c52396 100644\n>   --- a/builtin/checkout.c\n>   +++ b/builtin/checkout.c\n>   @@ -1491,7 +1491,9 @@ static int parse_branchname_arg(int argc, const char **argv,\n>    \telse if (dash_dash_pos == 1)\n>    \t\thas_dash_dash = 1; /* case (3) or (1) */\n>    \telse if (dash_dash_pos >= 2)\n>   -\t\tdie(_(\"only one reference expected, %d given.\"), dash_dash_pos);\n>   +\t\tdie(Q_(\"only one reference expected, %d given.\",\n>   +\t\t       \"only one reference expected, %d given.\",\n>   +\t\t       dash_dash_pos), dash_dash_pos);\n>    \topts->count_checkout_paths = !opts->quiet && !has_dash_dash;\n>    \n>    \tif (!strcmp(arg, \"-\"))\n>\n>  builtin/checkout.c | 8 ++++++--\n>  1 file changed, 6 insertions(+), 2 deletions(-)\n\nLooks good to me.  Will queue.  Thanks.\n\n"}]}