git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@grubix.eu>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Ralf Thielow <ralf.thielow@googlemail.com>
Subject: [PATCH v2 1/2] describe: localize debug output fully
Date: Mon, 27 Mar 2017 18:50:05 +0200	[thread overview]
Message-ID: <baac53f99636b00880c72daf8aec4d66a4755af2.1490633145.git.git@grubix.eu> (raw)
In-Reply-To: <xmqqpohf7opl.fsf@gitster.mtv.corp.google.com>
In-Reply-To: <cover.1490633145.git.git@grubix.eu>

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


  reply	other threads:[~2017-03-27 16:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 15:12 [PATCH 1/2] describe: localize debug output fully Michael J Gruber
2017-03-17 15:12 ` [PATCH 2/2] l10n: de: translate describe debug terms Michael J Gruber
2017-03-17 18:17 ` [PATCH 1/2] describe: localize debug output fully Junio C Hamano
2017-03-27 16:50   ` [PATCH v2 0/2] describe: localize debug output Michael J Gruber
2017-03-27 16:50     ` Michael J Gruber [this message]
2017-03-27 16:50     ` [PATCH v2 2/2] l10n: de: translate describe debug terms Michael J Gruber
2017-03-27 20:44     ` [PATCH v2 0/2] describe: localize debug output Junio C Hamano

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=baac53f99636b00880c72daf8aec4d66a4755af2.1490633145.git.git@grubix.eu \
    --to=git@grubix.eu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ralf.thielow@googlemail.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;
as well as URLs for NNTP newsgroup(s).