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

Re: [PATCH] advice: omit trailing whitespace

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 31, 2024, 06:43 UTC
Message-ID
<xmqqcyraj3z7.fsf@gitster.g>
In-Reply-To
<4c8da56e-974b-474e-aefe-1ced5ee69327@gmail.com>
Rubén Justo <rjusto@gmail.com> writes:
Show 18 quoted lines
>> >  	for (cp = buf.buf; *cp; cp = np) {
>> >  		np = strchrnul(cp, '\n');
>> > -		fprintf(stderr,	_("%shint: %.*s%s\n"),
>> > +		fprintf(stderr,	_("%shint:%s%.*s%s\n"),
>> >  			advise_get_color(ADVICE_COLOR_HINT),
>> > +			(np == cp) ? "" : " ",
>> >  			(int)(np - cp), cp,
>> >  			advise_get_color(ADVICE_COLOR_RESET));
>
> Thinking again on this I wonder, while we're here, if we could go further
> and move the "hint" literal to the args, to ease the translation work:
> -               fprintf(stderr, _("%shint:%s%.*s%s\n"),
> +               fprintf(stderr, "%s%s:%s%.*s%s\n",
>                         advise_get_color(ADVICE_COLOR_HINT),
> +                       _("hint"),
>                         (np == cp) ? "" : " ",
>                         (int)(np - cp), cp,
>                         advise_get_color(ADVICE_COLOR_RESET));

It is not guaranteed that any and all languages want to use a colon immediately after translation of "hint"; the current message string with or without my patch allows translators adjust that part to the target language, but your version will force them to always use only a colon there. Is that an improvement? I somehow do not think so.

Previous: Rubén JustoNext: Rubén Justo
Message 4 of 9 in “advice: omit trailing whitespace”
  1. advice: omit trailing whitespaceJunio C Hamano, Mar 29, 2024
  2. Rubén JustoMar 29, 2024
  3. Rubén JustoMar 31, 2024
  4. Junio C HamanoMar 31, 2024
  5. Rubén JustoMar 31, 2024
  6. Rubén JustoMar 31, 2024
  7. Junio C HamanoMar 31, 2024
  8. Rubén JustoApr 1, 2024
  9. Dragan SimicMar 29, 2024

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.