Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Jeff King <peff@xxxxxxxx> writes:
>
>> But most importantly, it means we could eventually colorize errors, too,
>> where we are not allowed to allocate.
>>
>> So perhaps:
>>
>>   void report_lines(FILE *out,
>>                     const char *color, const char *color_reset,
>> 		    const char *prefix, const char *msg);
>>
>> or something?
>
> Sounds good to me.  And if you hate the repeated "error:" prefix
> that makes the prefix on the second and subsequent lines included in
> cutting and pasting, we could use the two-prefix idea elsewhere in
> the thread, too.

If we do not want duplicate prefix, another approach is to leave
everything including alignment up to the translators.  For example,

        error(_("the first line of error.\n"
                "       ... and the second."));

could be a valid way to produce

        error: the first line of error.
               ... and the second.

on the display, and get it translated to

        ERRORX: THE FIRST LINE OF ERROR.
                ... AND THE SECOND.

with these entries for that hypothetical "shout in caps" language.

        msgid "error: "
        msgstr "ERRORX: "
        msgid "the first line of error.\n       ... and the second."
        msgstr"THE FIRST LINE OF ERROR.\n        ... AND THE SECOND."

So I do not think the two-prefix idea is necessary (and if people
prefer to have repeated prefix, that can also be done perfectly well
within this scheme---the second and subsequent message needs to
duplicate "error:" at the beginning, which is sort of ugly, but the
leading spaces for alignment we see above already knows how wide
"error:" and its translation is, so it is not that much worse
anyway).

But still, your suggestion to allow color/reset so that we can do
without extra allocation is a good idea.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux