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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2014, 17:38 UTC
Message-ID
<xmqqd2hfv4e1.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqior8dke6.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 29 quoted lines
> Junio C Hamano <gitster@pobox.com> 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.

Then I'll squash 61bf9709 (SQUASH??? fix decl-after-stmt and simplify, 2014-03-20) in before merging the patch to 'next'.

Previous: Matthieu Moy
Message 5 of 5 in “Bug? git status --porcelain --branch is translated”
  1. AnarkyMar 20, 2014
  2. status: disable translation when --porcelain is usedMatthieu Moy, Mar 20, 2014
  3. Junio C HamanoMar 20, 2014
  4. Matthieu MoyMar 21, 2014
  5. Junio C HamanoMar 21, 2014

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.