From: Abhishek Agarwal <agab0323@gmail.com>
To: git@vger.kernel.org
Cc: "Rubén Justo" <rjusto@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Patrick Steinhardt" <ps@pks.im>
Subject: [GSoC PATCH v2] add-patch: use Q_() for split hunk translation
Date: Fri, 20 Nov 2026 16:03:17 +0530 [thread overview]
Message-ID: <20261120103317.160931-1-agab0323@gmail.com> (raw)
In-Reply-To: <20261110193804.76958-1-agab0323@gmail.com>
The "Split into %d hunks." message uses _(), so a translation can
have only one form for every count. Some languages need more than
that. In Polish, 2 and 5 take different plural forms: the current
translation "Podzielono na %d skrawków" uses the form for 5, so a
split into 2 hunks reads "2 skrawków" instead of "2 skrawki".
Use Q_() and pass splittable_into as the count, so that gettext can
pick the form that fits the number.
Translators of a language with just a singular and a plural form,
such as German, now have to translate this message twice. In
exchange, translators of languages that need different forms for
"2 hunks" and "5 hunks" can get them right.
Signed-off-by: Abhishek Agarwal <agab0323@gmail.com>
---
Notes:
Changes since v1:
- Replaced the last sentence ("keeping the English output
unchanged") with the trade-off for translators, as Junio
suggested for a similar patch [1].
- Author and sign-off now use my real name instead of "aeron-gh".
- Rebased on current master. No code change.
The count is always 2 or more here, because "s" is only offered
when hunk->splittable_into > 1, so English never shows the
singular string. Q_() still needs it, and translators fill in
their own forms for the counts that do occur.
[1] https://lore.kernel.org/git/xmqqv76vnd5h.fsf@gitster.g/
add-patch.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/add-patch.c b/add-patch.c
index f27edcbe8d..4e75e2ceda 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1942,7 +1942,9 @@ static size_t patch_update_file(struct add_p_state *s,
} else if (!split_hunk(s, file_diff,
hunk - file_diff->hunk)) {
color_fprintf_ln(stdout, s->cfg.header_color,
- _("Split into %d hunks."),
+ Q_("Split into %d hunk.",
+ "Split into %d hunks.",
+ splittable_into),
(int)splittable_into);
rendered_hunk_index = -1;
}
--
2.56.0
prev parent reply other threads:[~2026-11-20 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 19:38 [GSoC PATCH] add-patch: use Q_() for split hunk translation aeron-gh
2026-11-20 10:33 ` Abhishek Agarwal [this message]
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=20261120103317.160931-1-agab0323@gmail.com \
--to=agab0323@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
--cc=rjusto@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