i18n: commit: mark message for translation

Mark message commit_utf8_warn for translation. Update tests to reflect changes. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Vasco Almeida committed Sep 19, 2016 at 13:08 UTC 4fa4b31507f28b3a6486e44b620ab36c6380cb7d
3 files changed +9 -9
commit.c
+4 -4
@@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
1511 }
1512
1513 static const char commit_utf8_warn[] =
1514 -"Warning: commit message did not conform to UTF-8.\n"
1515 -"You may want to amend it after fixing the message, or set the config\n"
1516 -"variable i18n.commitencoding to the encoding your project uses.\n";
1514 +N_("Warning: commit message did not conform to UTF-8.\n"
1515 + "You may want to amend it after fixing the message, or set the config\n"
1516 + "variable i18n.commitencoding to the encoding your project uses.\n");
1517
1518 int commit_tree_extended(const char *msg, size_t msg_len,
1519 const unsigned char *tree,
@@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
1566
1567 /* And check the encoding */
1568 if (encoding_is_utf8 && !verify_utf8(&buffer))
1569 - fprintf(stderr, commit_utf8_warn);
1569 + fprintf(stderr, _(commit_utf8_warn));
1570
1571 if (sign_commit && do_sign_commit(&buffer, sign_commit))
1572 return -1;
t/t3900-i18n-commit.sh
+4 -4
@@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
45 printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
46 >"$HOME/invalid" &&
47 git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
48 - grep "did not conform" "$HOME"/stderr
48 + test_i18ngrep "did not conform" "$HOME"/stderr
49 '
50
51 test_expect_success 'UTF-8 overlong sequences rejected' '
@@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' '
55 printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
56 >"$HOME/invalid" &&
57 git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
58 - grep "did not conform" "$HOME"/stderr
58 + test_i18ngrep "did not conform" "$HOME"/stderr
59 '
60
61 test_expect_success 'UTF-8 non-characters refused' '
@@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' '
64 printf "Commit message\n\nNon-character:\364\217\277\276\n" \
65 >"$HOME/invalid" &&
66 git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
67 - grep "did not conform" "$HOME"/stderr
67 + test_i18ngrep "did not conform" "$HOME"/stderr
68 '
69
70 test_expect_success 'UTF-8 non-characters refused' '
@@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' '
73 printf "Commit message\n\nNon-character:\357\267\220\n" \
74 >"$HOME/invalid" &&
75 git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
76 - grep "did not conform" "$HOME"/stderr
76 + test_i18ngrep "did not conform" "$HOME"/stderr
77 '
78
79 for H in ISO8859-1 eucJP ISO-2022-JP
t/t3901-i18n-patch.sh
+1 -1
@@ -295,7 +295,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
295
296 # commit-tree will warn that the commit message does not contain valid UTF-8
297 # as mailinfo did not convert it
298 - grep "did not conform" err &&
298 + test_i18ngrep "did not conform" err &&
299
300 check_encoding 2
301 '