Re: [RFC PATCH 2/3] usage: prefix all lines in `vreportf()`, not just the first
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 29, 2018, 12:08 UTC
- Message-ID
- <xmqqa7sihdf7.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CAN0heSry9ncTTzjw2fB=wxTAo3YPyQq-wbONpXCsfi_Syxfj-A@mail.gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 7 quoted lines
> About the _("\t")-approach that you mentioned up-thread. It would allow
> a translator to adjust all the indentations for a particular language.
> To be clear, what you mean is _(" " /* 9 spaces */) to align
> nicely with "warning: ", which is the longest English string. Then the
> translator would translate the nine spaces and all of "fatal: " and
> others to padded strings, all of the same length (not necessarily nine).
> Correct?I was envisioning that these
error: the first line of an error message
and the second line indented by 7 places (strlen("error:")+1)
info: the first line of an info message
and the second line indented by 6 places (strlen("info:")+1)are produced by
vreportf("error: ", " " /* 7 spaces */,
"the first line of an error message\nand the second ...");
vreportf("info: ", " " /* 6 spaces */,
"the first line of an info message\nand the second ...");And if all of these string literals were inside _(), then depending on how many display columns translated version of "error" and "info" takes in the target language, these 7-space and 6-space secondary prefixes would be "translated" differently.
Of course, since your language may translate "error" and "fatal" to different display columns, the 7-space secondary prefix in this one
vreportf("fatal: ", " " /* 7 spaces */,
"the first line of a fatal error message\nand the second ...");needs to be mapped to a string that is differnt from the 7-space for "error: ". I think you would use "contexts" to map the same source 7-space to different translated string when it becomes necessary.
https://www.gnu.org/software/gettext/manual/html_node/Contexts.html