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

Re: [RFC/PATCH] i18n of multi-line messages

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Dec 22, 2011, 06:54 UTC
Message-ID
<4EF2D436.3080303@viscovery.net>
In-Reply-To
<7vr4zxeaz5.fsf@alter.siamese.dyndns.org>
Am 12/22/2011 0:55, schrieb Junio C Hamano:
Show 19 quoted lines
>  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
Previous: Thomas RastNext: Junio C Hamano
Message 5 of 15 in “i18n of multi-line messages”
  1. i18n of multi-line messagesJunio C Hamano, Dec 21, 2011
  2. Ævar Arnfjörð BjarmasonDec 22, 2011
  3. Junio C HamanoDec 22, 2011
  4. Thomas RastDec 22, 2011
  5. Johannes SixtDec 22, 2011
  6. Junio C HamanoDec 22, 2011
  7. Junio C HamanoDec 22, 2011
  8. Junio C HamanoDec 22, 2011
  9. Johannes SixtDec 22, 2011
  10. Junio C HamanoDec 22, 2011
  11. Johannes SixtDec 23, 2011
  12. Junio C HamanoDec 23, 2011
  13. Chris PackhamDec 22, 2011
  14. Andreas SchwabDec 22, 2011
  15. Ævar Arnfjörð BjarmasonDec 22, 2011

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.