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

[PATCH] l10n: allows to translate diff messages

From
Jordi Mas via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 13, 2021, 12:01 UTC
Message-ID
<pull.1045.git.git.1626177676801.gitgitgadget@gmail.com>
From: Jordi Mas <jmas@softcatala.org>

Allows to translate the diff messages shown when the user commits, indicating the number of insertions, deletions and files changed.

Signed-off-by: Jordi Mas <jmas@softcatala.org>
---
    Allow to translate diff message
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1045%2Fjordimas%2Flocalize-msg-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1045/jordimas/localize-msg-v1
Pull-Request: https://github.com/git/git/pull/1045
 diff.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
index 52c791574b..29db9ce079 100644
--- a/diff.c
+++ b/diff.c
@@ -2593,7 +2593,7 @@ static void print_stat_summary_inserts_deletes(struct diff_options *options,
 	}
 
 	strbuf_addf(&sb,
-		    (files == 1) ? " %d file changed" : " %d files changed",
+		    Q_(" %d file changed", " %d files changed", files),
 		    files);
 
 	/*
@@ -2606,13 +2606,13 @@ static void print_stat_summary_inserts_deletes(struct diff_options *options,
 	 */
 	if (insertions || deletions == 0) {
 		strbuf_addf(&sb,
-			    (insertions == 1) ? ", %d insertion(+)" : ", %d insertions(+)",
+			    Q_(", %d insertion(+)", ", %d insertions(+)", insertions),
 			    insertions);
 	}
 
 	if (deletions || insertions == 0) {
 		strbuf_addf(&sb,
-			    (deletions == 1) ? ", %d deletion(-)" : ", %d deletions(-)",
+			    Q_(", %d deletion(-)", ", %d deletions(-)", deletions),
 			    deletions);
 	}
 	strbuf_addch(&sb, '\n');

base-commit: d486ca60a51c9cb1fe068803c3f540724e95e83a
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 4 in “l10n: allows to translate diff messages”
  1. l10n: allows to translate diff messagesJordi Mas via GitGitGadget, Jul 13, 2021
  2. Junio C HamanoJul 13, 2021
  3. Bagas SanjayaJul 14, 2021
  4. Ævar Arnfjörð BjarmasonJul 14, 2021

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.