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

[PATCH v2 1/2] describe: localize debug output fully

From
Michael J Gruber <git@grubix.eu>
Date
Mar 27, 2017, 16:50 UTC
Message-ID
<baac53f99636b00880c72daf8aec4d66a4755af2.1490633145.git.git@grubix.eu>
In-Reply-To
<xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>

git describe --debug localizes all debug messages but not the terms head, lightweight, annotated that it outputs for the candidates. Localize them, too.

Signed-off-by: Michael J Gruber <git@grubix.eu>
---
 builtin/describe.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index 45adbf67d5..99e963dfe7 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -50,7 +50,7 @@ struct commit_name {
 };
 
 static const char *prio_names[] = {
-	"head", "lightweight", "annotated",
+	N_("head"), N_("lightweight"), N_("annotated"),
 };
 
 static int commit_name_cmp(const struct commit_name *cn1,
@@ -395,10 +395,19 @@ static void describe(const char *arg, int last_one)
 	free_commit_list(list);
 
 	if (debug) {
+		static int label_width = -1;
+		if (label_width < 0) {
+			int i, w;
+			for (i = 0; i < ARRAY_SIZE(prio_names); i++) {
+				w = strlen(_(prio_names[i]));
+				if (label_width < w)
+					label_width = w;
+			}
+		}		
 		for (cur_match = 0; cur_match < match_cnt; cur_match++) {
 			struct possible_tag *t = &all_matches[cur_match];
-			fprintf(stderr, " %-11s %8d %s\n",
-				prio_names[t->name->prio],
+			fprintf(stderr, " %-*s %8d %s\n",
+				label_width, _(prio_names[t->name->prio]),
 				t->depth, t->name->path);
 		}
 		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
-- 
2.12.2.584.g7becbf139a
Previous: Junio C HamanoNext: Michael J Gruber
Message 4 of 7 in “describe: localize debug output fully”
  1. 1/2 describe: localize debug output fullyMichael J Gruber, Mar 17, 2017
  2. 2/2 l10n: de: translate describe debug termsMichael J Gruber, Mar 17, 2017
  3. Junio C HamanoMar 17, 2017
  4. 1/2 describe: localize debug output fullyMichael J Gruber, Mar 27, 2017
  5. 2/2 l10n: de: translate describe debug termsMichael J Gruber, Mar 27, 2017
  6. 0/2 describe: localize debug outputMichael J Gruber, Mar 27, 2017
  7. Junio C HamanoMar 27, 2017

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.