All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [RFC/PATCH] i18n of multi-line messages
Date: Thu, 22 Dec 2011 07:54:46 +0100	[thread overview]
Message-ID: <4EF2D436.3080303@viscovery.net> (raw)
In-Reply-To: <7vr4zxeaz5.fsf@alter.siamese.dyndns.org>

Am 12/22/2011 0:55, schrieb Junio C Hamano:
>  void advise(const char *advice, ...)
>  {
> +	struct strbuf buf = STRBUF_INIT;
>  	va_list params;
> +	const char *cp, *np;
>  
>  	va_start(params, advice);
> -	vreportf("hint: ", advice, params);
> +	strbuf_addf(&buf, advice, params);
>  	va_end(params);
> +
> +	for (cp = buf.buf; *cp; cp = np) {
> +		np = strchrnul(cp, '\n');
> +		fprintf(stderr, "%s%.*s\n", _("hint: "), (int)(np - cp), cp);
> +		if (*np)
> +			np++;
> +	}
> +	strbuf_release(&buf);
>  }

IMHO, this logic should be moved into vreportf(), and we get proper
prefixing of multi-line warning(), error(), and die() messages for free.

> +		advise(_("Fix them up in the work tree,\n"
> +			 "and then use 'git add/rm <file>' as\n"
> +			 "appropriate to mark resolution and make a commit,\n"
> +			 "or use 'git commit -a'."));

<rant>
Can people please pay attention how they break multi-line messages? In
this particular case, (1) even in a 80-columns terminal the lines are
spectacularly short, and (2) a break in the middle of a word group can
easily be avoided such that the result does not look ugly:

hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.

And, no, "It would break the 80-column limit of source code" does not
count for user-visible messages.
</rant>

-- Hannes

  parent reply	other threads:[~2011-12-22  6:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 23:55 [RFC/PATCH] i18n of multi-line messages Junio C Hamano
2011-12-22  0:14 ` Ævar Arnfjörð Bjarmason
2011-12-22  0:20   ` Junio C Hamano
2011-12-22 17:07     ` Thomas Rast
2011-12-22  6:54 ` Johannes Sixt [this message]
2011-12-22  7:00   ` Junio C Hamano
2011-12-22  7:00   ` Junio C Hamano
2011-12-22  7:38   ` Junio C Hamano
2011-12-22  8:19     ` Johannes Sixt
2011-12-22 18:08       ` Junio C Hamano
2011-12-23  6:42         ` Johannes Sixt
2011-12-23 20:54           ` Junio C Hamano
2011-12-22 10:40     ` Chris Packham
2011-12-22 11:56       ` Andreas Schwab
2011-12-22 21:44     ` Ævar Arnfjörð Bjarmason

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=4EF2D436.3080303@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.