Thread (3 messages) 3 messages, 2 authors, 2024-03-31

Re: [PATCH] advice: omit trailing whitespace

From: Rubén Justo <hidden>
Date: 2024-03-31 08:11:18

On Sun, Mar 31, 2024 at 09:11:59AM +0200, Rubén Justo wrote:
On Sat, Mar 30, 2024 at 11:43:40PM -0700, Junio C Hamano wrote:
quoted
Rubén Justo [off-list ref] writes:
quoted
quoted
quoted
 	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.
I was just thinking if leaving the format open to the translation is a
sane option.  Maybe we can move the colon to the literal in the args,
too.
Just for the record, zh_CN (Chinese) and zh_TW (Traditional Chinese)
do not use ':' on its translation, but ':'

So, if we go the way I proposed we'll need to move the ':' too.  I
still think it's an improvement.  But, optional to this series.
In any case, the patch is OK as it is.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help