threads / patch / 66824

patchadd-patch: use Q_() for split hunk translation

Subject: [GSoC PATCH] add-patch: use Q_() for split hunk translation

## tl;dr

One message between Nov 10, 2026 and Nov 10, 2026. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

aeron-gh· Nov 10, 2026, 19:38 UTC · lore

The "Split into %d hunks." message uses _(), which provides the same translation for every number. The Polish translation shows "2 skrawków", but the correct form is "2 skrawki". Numbers 2 and 5 need different plural forms.

Use Q_() with singular and plural forms, passing splittable_into as the count. This lets translators provide the correct plural forms while keeping the English output unchanged.

Signed-off-by: aeron-gh <agab0323@gmail.com>
---
This patch is part of my GSoC 2027 microproject. Mahmoud
announced this issue in March, but no patch followed:
https://lore.kernel.org/git/CAC5WPUdYxm-7Pjq4oAddLKXjSa7B0YdK8ashyeR9vhCQt+wvPA@mail.gmail.com/
 add-patch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to add-patch.c +3 −1
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

← back to recent threads