Skip to content

Commit 87a23e7

Browse files
committed
Merge branch 'jc/advise-i18n'
* jc/advise-i18n: i18n of multi-line advice messages
2 parents aad0709 + 23cb5bf commit 87a23e7

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

advice.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ static struct {
2121

2222
void advise(const char *advice, ...)
2323
{
24+
struct strbuf buf = STRBUF_INIT;
2425
va_list params;
26+
const char *cp, *np;
2527

2628
va_start(params, advice);
27-
vreportf("hint: ", advice, params);
29+
strbuf_addf(&buf, advice, params);
2830
va_end(params);
31+
32+
for (cp = buf.buf; *cp; cp = np) {
33+
np = strchrnul(cp, '\n');
34+
fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
35+
if (*np)
36+
np++;
37+
}
38+
strbuf_release(&buf);
2939
}
3040

3141
int git_default_advice_config(const char *var, const char *value)
@@ -46,16 +56,15 @@ int git_default_advice_config(const char *var, const char *value)
4656
int error_resolve_conflict(const char *me)
4757
{
4858
error("'%s' is not possible because you have unmerged files.", me);
49-
if (advice_resolve_conflict) {
59+
if (advice_resolve_conflict)
5060
/*
5161
* Message used both when 'git commit' fails and when
5262
* other commands doing a merge do.
5363
*/
54-
advise("Fix them up in the work tree,");
55-
advise("and then use 'git add/rm <file>' as");
56-
advise("appropriate to mark resolution and make a commit,");
57-
advise("or use 'git commit -a'.");
58-
}
64+
advise(_("Fix them up in the work tree,\n"
65+
"and then use 'git add/rm <file>' as\n"
66+
"appropriate to mark resolution and make a commit,\n"
67+
"or use 'git commit -a'."));
5968
return -1;
6069
}
6170

builtin/revert.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,10 @@ static void print_advice(int show_hint)
343343
return;
344344
}
345345

346-
if (show_hint) {
347-
advise("after resolving the conflicts, mark the corrected paths");
348-
advise("with 'git add <paths>' or 'git rm <paths>'");
349-
advise("and commit the result with 'git commit'");
350-
}
346+
if (show_hint)
347+
advise(_("after resolving the conflicts, mark the corrected paths\n"
348+
"with 'git add <paths>' or 'git rm <paths>'\n"
349+
"and commit the result with 'git commit'"));
351350
}
352351

353352
static void write_message(struct strbuf *msgbuf, const char *filename)

0 commit comments

Comments
 (0)