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

Re: [PATCH] Make a colon translatable

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 11, 2022, 19:29 UTC
Message-ID
<xmqq5ynfh101.fsf@gitster.g>
In-Reply-To
<-9xEw4skKJRhRp5v7WmxeS2n5xv-xmM0HWqmoiameagKhpiDOP9y3Yxj7WFy6M-jztxqug8DKopXIr_op09VlGPkUC7iG5V6xXjKh_SxHEg=@palard.fr>
Julien Palard <julien@palard.fr> writes:
Show 8 quoted lines
> In french we use a no-break space before colon, so with formatting
> like:
>
>     printf("... %s: ...", _("some string"))
>
> We can't cleanly add our no-break space, so I think:
>
>     printf("... %s ...", _("some string:"))

Sorry, but I do not quite buy this. The above is a representative example of what we call "sentence lego", which is what we absolutely want to avoid, isn't it?

We'd rather want to see
	printf_like_function(_("Use 'git %s' ...", "string"));

when "string" is something that should not be translated to begin with (e.g. "add" to form "git add"), and different languages can use different conventions for quoting the command name (a translation may want to use something other than single-quotes, for example).

And in a less optimal case,
	printf_like_function(_("%s: ...", _("string")));

would be needed, when "string" is something that is to be translated (e.g. a phrase used as a label, like "Untracked files" in the code this patch touches). I think the case you have is the latter one.

Show 10 quoted lines
> diff --git a/wt-status.c b/wt-status.c
> index d33f9272b7..ef0c276c3d 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -248,7 +248,7 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
>  					     const char *how)
>  {
>  	const char *c = color(WT_STATUS_HEADER, s);
> -	status_printf_ln(s, c, "%s:", what);
> +	status_printf_ln(s, c, "%s", what);
I.e. this one is better handled by
	status_printf_ln(s, c, _("%s:"), what);

as _(...) in C-locale is original-language centric, where we want the label to be <phrase> immediately followed by a colon. And that allows French translation to have nbsp before the colon.

>  	if (s->show_untracked_files) {
> -		wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
> +		wt_longstatus_print_other(s, &s->untracked, _("Untracked files:"), "add");
Then this <phrase>, to be used in the label above, can be without colon.
>  		if (s->show_ignored_mode)
> -			wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
> +			wt_longstatus_print_other(s, &s->ignored, _("Ignored files:"), "add -f");
Ditto.
Thanks.
Previous: Julien PalardNext: Ævar Arnfjörð Bjarmason
Message 2 of 8 in “Make a colon translatable”
  1. Make a colon translatableJulien Palard, Apr 11, 2022
  2. Junio C HamanoApr 11, 2022
  3. Ævar Arnfjörð BjarmasonApr 12, 2022
  4. Junio C HamanoApr 12, 2022
  5. Jean-Noël AvilaApr 13, 2022
  6. Junio C HamanoApr 13, 2022
  7. Julien PalardApr 12, 2022
  8. Junio C HamanoApr 12, 2022

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.