Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] status: disable translation when --porcelain is used

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:25

Matthieu Moy [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
quoted
quoted
diff --git a/wt-status.c b/wt-status.c
index a452407..e55e5b9 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1509,19 +1509,23 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
 		return;
 	}
 
+	const char *gone   = s->no_gettext ? "gone"   : _("gone");
+	const char *behind = s->no_gettext ? "behind " : _("behind ");
+	const char *ahead  = s->no_gettext ? "ahead "  : _("ahead ");
Having to repeat the same string constant twice (and a half for the
variable name) each is an eyesore.  I wonder if we can do better,
perhaps with:

#define LABEL(string) (s->no_gettext ? (string) : _(string))

and then

	color_fprintf(s->fp, header_color, LABEL(N_("gone")));

or something along those lines?
I first thought about trying something clever with the preprocessor, but
since it's only for 3 strings, I went the KISS way. I tend to prefer my
version for simplicity, but no strong opinion here.
Then I'll squash 61bf9709 (SQUASH??? fix decl-after-stmt and
simplify, 2014-03-20) in before merging the patch to 'next'.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help