On 25 May 2018 at 11:14, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: > >>> + warning("the '-l' option is an alias for '--create-reflog' and"); >>> + warning("has no effect in list mode. This option will soon be"); >>> + warning("removed and you should omit it (or use '--list' instead)."); > > By the way, this is one of these times when I feel that we should > have a better multi-line message support in die/error/warning/info > functions. Ideally, I should be able to write [...] > warning(_("the '-l' option is an alias for '--create-reflog' and\n" > "has no effect in list mode, This option will soon be\n" > "removed and you should omit it (or use '--list' instead).")); [...] > and warning() would: > > - do the sprintf formatting thing as necessary to prepare a long multi-line > message; > > - chomp that into lines at '\n' boundary; and > > - give each of these lines with _("warning: ") prefixed. > > That way, translators can choose to make the resulting message to > different number of lines from the original easily. How about something like this? The first two patches implement the above three points, except for the translation of "warning: ". The third patch is the main reason this is marked RFC. It translates "warning: " and similar, and breaks quite a few tests under GETTEXT_POISON since we grep for, e.g., "warning" on stderr. I could annotate those tests, but since I'm running out of time anyway, I thought I'd post this as a heads-up of "I'm looking into this". I do wonder: If our tests rely on grepping for "warning" (for pretty good reasons), how many scripts out there do something similar (for maybe-not-so-good reasons, but still)? Do we want to avoid breaking them? Also left to do is to convert any existing lego-ing users to the single-string form that Junio wished for above. Martin Martin Ågren (3): usage: extract `prefix_suffix_lines()` from `advise()` usage: prefix all lines in `vreportf()`, not just the first usage: translate the "error: "-prefix and others t/t1011-read-tree-sparse-checkout.sh | 6 ++--- t/t1506-rev-parse-diagnosis.sh | 2 +- t/t1600-index.sh | 6 ++--- t/t3600-rm.sh | 36 ++++++++++++------------- t/t5512-ls-remote.sh | 6 ++--- t/t7607-merge-overwrite.sh | 6 ++--- t/t7609-merge-co-error-msgs.sh | 39 ++++++++++++++-------------- git-compat-util.h | 8 ++++++ advice.c | 18 ++++++------- usage.c | 28 ++++++++++++++++---- 10 files changed, 89 insertions(+), 66 deletions(-) -- 2.17.0.1181.g093e983b05