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 12, 2022, 16:26 UTC
Message-ID
<xmqq8rsaclom.fsf@gitster.g>
In-Reply-To
<CmgFntqFQcIxsSKePSKmmWvAMwsl-9shDqzWTT9GqI3S6PXNdhTTX6LypjY0l-R8B52pkh_MpYtq-NbbDjXT6EuZ9_S-QV4cUqxKhjZUpw8=@palard.fr>
Julien Palard <julien@palard.fr> writes:
Show 10 quoted lines
> I understand your comment while seeing my badly choosen example
> with `_("some string:")`, but in the patch isn't your proposition
> more sentence-lego-ish than mine? If I understand correctly you're
> proposing to replace:
>
>     printf("%s", _("Untracked files:"))
>
> with:
>
>     printf(_("%s:"), _("Untracked files"))
Hmph, I am talking about
diff --git i/wt-status.c w/wt-status.c
index d33f9272b7..f475194ff8 100644
--- i/wt-status.c
+++ w/wt-status.c
@@ -249,5 +249,5 @@ static void wt_longstatus_print_other_header(struct wt_status *s,
 {
 	const char *c = color(WT_STATUS_HEADER, s);
-	status_printf_ln(s, c, "%s:", what);
+	status_printf_ln(s, c, _("%s:"), what);
 	if (!s->hints)
 		return;

where the callers already supply _("Untracked files") and _("Ignored files")
without trailing colon in "what" when calling wt_longstatus_print_other(),
which is a direct caller that passes "what" to this function.

So, no, I am replacing

	printf("%s:", _("Untracked files"))

with

	printf(_("%s:"), _("Untracked files"))

and no other changes are required.  When translating "%s:", French
translation can insert nbsp before the colon to make it "%s :",
right to left languages may want to put their equivalent to colon
that comes after a heading on the left side of the "%s", etc.

> This hides information to the translator (the presence of a
> following colon while translating 'Untracked files').

With "Untracked files" and "Ignored files", we indicate certain
concepts and interpolate it in _("%s:"), i.e. a version localized to
adjust to the presentation convention of "label followed by a
separating colon".  Unless your language requires to translate
"Untracked files" differently when it is used as a "label" to be
followed by a separating colon and when it appears elsewhere in a
sentence, I am not sure how it helps to mark "Untracked files" as
appearing as a header label.

Besides, in the existing code, the form that is equivalent to

	printf("%s:", _("Untracked files"))

is being used, and where that "Untracked files" appear is two level
function calls away from the actual "%s:" (i.e. "label and
separator").  Aren't translators translating this string without
extra context?

> It would be
> OK if we were 100% sure no translations can be impacted by this. I
> only speak french and english, so I don't know. Maybe I should
> rename `what` to `heading`? I may clarify a bit, `what` make me
> feel it can be reused, but it's only used once alone on its line.

The way the function wt_longstatus_print_other() uses "what" and
"how" looks quite clear.  What kind of paths are being reported (are
they ignored files?  untracked files?  something else?) and how the
user can rectify the situation if they want these paths included in
the tracked set of paths.  I am afraid renaming to "heading" makes
it even less clear than leaving it to "what".  A word that indicates
that it refers to "category of paths" more clearly may make a good
replacement, but perhaps I am not understanding where exactly your
"this hides the information" comes from and makes you worry about
it.  Besides, would translators work off of .po and .pot files, not
the C-source?  Do they even have ready access to the variable names
to help them infer how the strings are used to begin with?

If translators truly benefit from knowing that the string "Untracked
files" is used as a heading, we could use /* TRANSLATORS: insn */
comment to help them.  Since I seem not to get where your concern
comes from, I cannot tell if it would help.

More info needed, I guess?
Previous: Julien Palard
Message 8 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.