From 23cb5bf3b3b9699bf00fa38c4c08f32f8c60b529 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 22 Dec 2011 11:21:26 -0800 Subject: i18n of multi-line advice messages Advice messages are by definition meant for human end-users, and prime candidates for i18n/l10n. They tend to also be more verbose to be helpful, and need to be longer than just one line. Although we do not have parameterized multi-line advice messages yet, once we do, we cannot emit such a message like this: advise(_("Please rename %s to something else"), gostak); advise(_("so that we can avoid distimming %s unnecessarily."), doshes); because some translations may need to have the replacement of 'gostak' on the second line (or 'doshes' on the first line). Some languages may even need to use three lines in order to fit the same message within a reasonable width. Instead, it has to be a single advise() construct, like this: advise(_("Please rename %s to something else\n" "so that we can avoid distimming %s unnecessarily."), gostak, doshes); Update the advise() function and its existing callers to - take a format string that can be multi-line and translatable as a whole; - use the string and the parameters to form a localized message; and - show each line in the result with the localization of the "hint: ". Signed-off-by: Junio C Hamano --- builtin/revert.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'builtin/revert.c') diff --git a/builtin/revert.c b/builtin/revert.c index 1ea525c10e..3ad14a1f98 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -332,11 +332,10 @@ static void print_advice(int show_hint) return; } - if (show_hint) { - advise("after resolving the conflicts, mark the corrected paths"); - advise("with 'git add ' or 'git rm '"); - advise("and commit the result with 'git commit'"); - } + if (show_hint) + advise(_("after resolving the conflicts, mark the corrected paths\n" + "with 'git add ' or 'git rm '\n" + "and commit the result with 'git commit'")); } static void write_message(struct strbuf *msgbuf, const char *filename) -- cgit v1.2.3