From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, ghostanarky@gmail•com
Subject: Re: [PATCH] status: disable translation when --porcelain is used
Date: Fri, 21 Mar 2014 09:29:53 +0100 [thread overview]
Message-ID: <vpqior8dke6.fsf@anie.imag.fr> (raw)
In-Reply-To: <xmqq38iczrr4.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 20 Mar 2014 10:47:43 -0700")
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.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2014-03-21 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 10:31 Bug? git status --porcelain --branch is translated Anarky
2014-03-20 12:12 ` [PATCH] status: disable translation when --porcelain is used Matthieu Moy
2014-03-20 17:47 ` Junio C Hamano
2014-03-21 8:29 ` Matthieu Moy [this message]
2014-03-21 17:38 ` 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=vpqior8dke6.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp$(echo .)fr \
--cc=ghostanarky@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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