From: Ralf Thielow <ralf.thielow@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, worldhello.net@gmail.com, pclouds@gmail.com
Subject: Re: [PATCH 1/2] advice: extract function to print messages with prefix
Date: Fri, 7 Sep 2012 21:56:14 +0200 [thread overview]
Message-ID: <CAN0XMOK5QnNn8471RF4y7u_X0rfda=-J-KrCtyMsgCGHXNrwVw@mail.gmail.com> (raw)
In-Reply-To: <7v1uidy6ga.fsf@alter.siamese.dyndns.org>
On Fri, Sep 7, 2012 at 9:32 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ralf Thielow <ralf.thielow@gmail.com> writes:
>
>> Extract a function that allows to print messages
>> with a prefix.
>>
>> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
>> ---
>> advice.c | 14 ++++++++++----
>> advice.h | 1 +
>> 2 Dateien geändert, 11 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
>>
>> diff --git a/advice.c b/advice.c
>> index edfbd4a..e73d53b 100644
>> --- a/advice.c
>> +++ b/advice.c
>> @@ -25,25 +25,31 @@ static struct {
>> { "detachedhead", &advice_detached_head },
>> };
>>
>> -void advise(const char *advice, ...)
>> +void print_with_prefix(const char *prefix, const char *msg, ...)
>> {
>> struct strbuf buf = STRBUF_INIT;
>> va_list params;
>> const char *cp, *np;
>>
>> - va_start(params, advice);
>> - strbuf_vaddf(&buf, advice, params);
>> + va_start(params, msg);
>> + strbuf_vaddf(&buf, msg, params);
>> va_end(params);
>>
>> for (cp = buf.buf; *cp; cp = np) {
>> np = strchrnul(cp, '\n');
>> - fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
>> + fprintf(stderr, "%s %.*s\n", prefix, (int)(np - cp), cp);
>
> Hrm, naively, printf("%s: %.*s\n", _("hint"), ...) might look more
> natural, but I vaguely recall that the current code places _()
> around the entire "hint: %.*s\n" on purpose. IIRC, it was to allow
> translations that flow from RTL e.g. ".siht od t'nod :tnih".
>
> Doesn't this patch break it?
Sorry but I don't know what you mean with "translations that flow
from RTL e.g. ".siht od t'nod :tnih"." so I can't check this.
As far as I can see the callers only put a simple message in it,
e.g. advise(_("Commit your changes or stash them to proceed."));
So I don't think that this patch would break anything.
next prev parent reply other threads:[~2012-09-07 19:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 17:11 [PATCH/RFC] l10n: de.po: translate 2 new messages Ralf Thielow
2012-09-05 17:21 ` Ralf Thielow
2012-09-06 16:44 ` Thomas Rast
2012-09-06 17:15 ` Ralf Thielow
2012-09-07 10:31 ` Jiang Xin
2012-09-07 16:36 ` Ralf Thielow
2012-09-07 17:05 ` Ralf Thielow
2012-09-07 17:12 ` Ralf Thielow
2012-09-07 17:44 ` Junio C Hamano
2012-09-07 19:05 ` [PATCH 0/2] multiline prefixes on messages Ralf Thielow
2012-09-07 19:05 ` [PATCH 1/2] advice: extract function to print messages with prefix Ralf Thielow
2012-09-07 19:32 ` Junio C Hamano
2012-09-07 19:56 ` Ralf Thielow [this message]
2012-09-07 20:52 ` Junio C Hamano
2012-09-07 21:09 ` Ralf Thielow
2012-09-07 21:16 ` Junio C Hamano
2012-09-07 21:20 ` Junio C Hamano
2012-09-07 19:05 ` [PATCH 2/2] i18n: mark prefix "warning:" for translation Ralf Thielow
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='CAN0XMOK5QnNn8471RF4y7u_X0rfda=-J-KrCtyMsgCGHXNrwVw@mail.gmail.com' \
--to=ralf.thielow@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=worldhello.net@gmail.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).