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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

>> 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.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]