Skip to content

Commit 8969fea

Browse files
committed
Merge branch 'va/i18n-more'
Even more i18n. * va/i18n-more: i18n: stash: mark messages for translation i18n: notes-merge: mark die messages for translation i18n: ident: mark hint for translation i18n: i18n: diff: mark die messages for translation i18n: connect: mark die messages for translation i18n: commit: mark message for translation
2 parents e447d31 + 850251f commit 8969fea

10 files changed

+48
-43
lines changed

commit.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
15111511
}
15121512

15131513
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");
15171517

15181518
int commit_tree_extended(const char *msg, size_t msg_len,
15191519
const unsigned char *tree,
@@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
15661566

15671567
/* And check the encoding */
15681568
if (encoding_is_utf8 && !verify_utf8(&buffer))
1569-
fprintf(stderr, commit_utf8_warn);
1569+
fprintf(stderr, _(commit_utf8_warn));
15701570

15711571
if (sign_commit && do_sign_commit(&buffer, sign_commit))
15721572
return -1;

connect.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ int check_ref_type(const struct ref *ref, int flags)
4646
static void die_initial_contact(int unexpected)
4747
{
4848
if (unexpected)
49-
die("The remote end hung up upon initial contact");
49+
die(_("The remote end hung up upon initial contact"));
5050
else
51-
die("Could not read from remote repository.\n\n"
52-
"Please make sure you have the correct access rights\n"
53-
"and the repository exists.");
51+
die(_("Could not read from remote repository.\n\n"
52+
"Please make sure you have the correct access rights\n"
53+
"and the repository exists."));
5454
}
5555

5656
static void parse_one_symref_info(struct string_list *symref, const char *val, int len)

diff.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
5656
GIT_COLOR_NORMAL, /* FUNCINFO */
5757
};
5858

59+
static NORETURN void die_want_option(const char *option_name)
60+
{
61+
die(_("option '%s' requires a value"), option_name);
62+
}
63+
5964
static int parse_diff_color_slot(const char *var)
6065
{
6166
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
@@ -3341,7 +3346,7 @@ void diff_setup_done(struct diff_options *options)
33413346
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
33423347
count++;
33433348
if (count > 1)
3344-
die("--name-only, --name-status, --check and -s are mutually exclusive");
3349+
die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
33453350

33463351
/*
33473352
* Most of the time we can say "there are changes"
@@ -3537,7 +3542,7 @@ static int stat_opt(struct diff_options *options, const char **av)
35373542
if (*arg == '=')
35383543
width = strtoul(arg + 1, &end, 10);
35393544
else if (!*arg && !av[1])
3540-
die("Option '--stat-width' requires a value");
3545+
die_want_option("--stat-width");
35413546
else if (!*arg) {
35423547
width = strtoul(av[1], &end, 10);
35433548
argcount = 2;
@@ -3546,7 +3551,7 @@ static int stat_opt(struct diff_options *options, const char **av)
35463551
if (*arg == '=')
35473552
name_width = strtoul(arg + 1, &end, 10);
35483553
else if (!*arg && !av[1])
3549-
die("Option '--stat-name-width' requires a value");
3554+
die_want_option("--stat-name-width");
35503555
else if (!*arg) {
35513556
name_width = strtoul(av[1], &end, 10);
35523557
argcount = 2;
@@ -3555,7 +3560,7 @@ static int stat_opt(struct diff_options *options, const char **av)
35553560
if (*arg == '=')
35563561
graph_width = strtoul(arg + 1, &end, 10);
35573562
else if (!*arg && !av[1])
3558-
die("Option '--stat-graph-width' requires a value");
3563+
die_want_option("--stat-graph-width");
35593564
else if (!*arg) {
35603565
graph_width = strtoul(av[1], &end, 10);
35613566
argcount = 2;
@@ -3564,7 +3569,7 @@ static int stat_opt(struct diff_options *options, const char **av)
35643569
if (*arg == '=')
35653570
count = strtoul(arg + 1, &end, 10);
35663571
else if (!*arg && !av[1])
3567-
die("Option '--stat-count' requires a value");
3572+
die_want_option("--stat-count");
35683573
else if (!*arg) {
35693574
count = strtoul(av[1], &end, 10);
35703575
argcount = 2;

git-stash.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ create_stash () {
100100
u_tree=$(git write-tree) &&
101101
printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree &&
102102
rm -f "$TMPindex"
103-
) ) || die "Cannot save the untracked files"
103+
) ) || die "$(gettext "Cannot save the untracked files")"
104104

105105
untracked_commit_option="-p $u_commit";
106106
else
@@ -248,7 +248,7 @@ save_stash () {
248248

249249
if test -n "$patch_mode" && test -n "$untracked"
250250
then
251-
die "Can't use --patch and --include-untracked or --all at the same time"
251+
die "$(gettext "Can't use --patch and --include-untracked or --all at the same time")"
252252
fi
253253

254254
stash_msg="$*"
@@ -494,7 +494,7 @@ apply_stash () {
494494
GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" &&
495495
GIT_INDEX_FILE="$TMPindex" git checkout-index --all &&
496496
rm -f "$TMPindex" ||
497-
die 'Could not restore untracked files from stash'
497+
die "$(gettext "Could not restore untracked files from stash")"
498498
fi
499499

500500
eval "

ident.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,17 @@ int split_ident_line(struct ident_split *split, const char *line, int len)
331331
}
332332

333333
static const char *env_hint =
334-
"\n"
335-
"*** Please tell me who you are.\n"
336-
"\n"
337-
"Run\n"
338-
"\n"
339-
" git config --global user.email \"[email protected]\"\n"
340-
" git config --global user.name \"Your Name\"\n"
341-
"\n"
342-
"to set your account\'s default identity.\n"
343-
"Omit --global to set the identity only in this repository.\n"
344-
"\n";
334+
N_("\n"
335+
"*** Please tell me who you are.\n"
336+
"\n"
337+
"Run\n"
338+
"\n"
339+
" git config --global user.email \"[email protected]\"\n"
340+
" git config --global user.name \"Your Name\"\n"
341+
"\n"
342+
"to set your account\'s default identity.\n"
343+
"Omit --global to set the identity only in this repository.\n"
344+
"\n");
345345

346346
const char *fmt_ident(const char *name, const char *email,
347347
const char *date_str, int flag)
@@ -356,21 +356,21 @@ const char *fmt_ident(const char *name, const char *email,
356356
if (!name) {
357357
if (strict && ident_use_config_only
358358
&& !(ident_config_given & IDENT_NAME_GIVEN)) {
359-
fputs(env_hint, stderr);
359+
fputs(_(env_hint), stderr);
360360
die("no name was given and auto-detection is disabled");
361361
}
362362
name = ident_default_name();
363363
using_default = 1;
364364
if (strict && default_name_is_bogus) {
365-
fputs(env_hint, stderr);
365+
fputs(_(env_hint), stderr);
366366
die("unable to auto-detect name (got '%s')", name);
367367
}
368368
}
369369
if (!*name) {
370370
struct passwd *pw;
371371
if (strict) {
372372
if (using_default)
373-
fputs(env_hint, stderr);
373+
fputs(_(env_hint), stderr);
374374
die("empty ident name (for <%s>) not allowed", email);
375375
}
376376
pw = xgetpwuid_self(NULL);
@@ -381,12 +381,12 @@ const char *fmt_ident(const char *name, const char *email,
381381
if (!email) {
382382
if (strict && ident_use_config_only
383383
&& !(ident_config_given & IDENT_MAIL_GIVEN)) {
384-
fputs(env_hint, stderr);
384+
fputs(_(env_hint), stderr);
385385
die("no email was given and auto-detection is disabled");
386386
}
387387
email = ident_default_email();
388388
if (strict && default_email_is_bogus) {
389-
fputs(env_hint, stderr);
389+
fputs(_(env_hint), stderr);
390390
die("unable to auto-detect email address (got '%s')", email);
391391
}
392392
}

notes-merge.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,15 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)
270270
if (file_exists(git_path(NOTES_MERGE_WORKTREE)) &&
271271
!is_empty_dir(git_path(NOTES_MERGE_WORKTREE))) {
272272
if (advice_resolve_conflict)
273-
die("You have not concluded your previous "
273+
die(_("You have not concluded your previous "
274274
"notes merge (%s exists).\nPlease, use "
275275
"'git notes merge --commit' or 'git notes "
276276
"merge --abort' to commit/abort the "
277277
"previous merge before you start a new "
278-
"notes merge.", git_path("NOTES_MERGE_*"));
278+
"notes merge."), git_path("NOTES_MERGE_*"));
279279
else
280-
die("You have not concluded your notes merge "
281-
"(%s exists).", git_path("NOTES_MERGE_*"));
280+
die(_("You have not concluded your notes merge "
281+
"(%s exists)."), git_path("NOTES_MERGE_*"));
282282
}
283283

284284
if (safe_create_leading_directories_const(git_path(

t/t3310-notes-merge-manual-resolve.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
225225
test -d .git/NOTES_MERGE_WORKTREE &&
226226
test_must_fail git notes merge z >output 2>&1 &&
227227
# Output should indicate what is wrong
228-
grep -q "\\.git/NOTES_MERGE_\\* exists" output
228+
test_i18ngrep -q "\\.git/NOTES_MERGE_\\* exists" output
229229
'
230230

231231
# Setup non-conflicting merge between x and new notes ref w

t/t3900-i18n-commit.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
4545
printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
4646
>"$HOME/invalid" &&
4747
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
48-
grep "did not conform" "$HOME"/stderr
48+
test_i18ngrep "did not conform" "$HOME"/stderr
4949
'
5050

5151
test_expect_success 'UTF-8 overlong sequences rejected' '
@@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' '
5555
printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
5656
>"$HOME/invalid" &&
5757
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
58-
grep "did not conform" "$HOME"/stderr
58+
test_i18ngrep "did not conform" "$HOME"/stderr
5959
'
6060

6161
test_expect_success 'UTF-8 non-characters refused' '
@@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' '
6464
printf "Commit message\n\nNon-character:\364\217\277\276\n" \
6565
>"$HOME/invalid" &&
6666
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
67-
grep "did not conform" "$HOME"/stderr
67+
test_i18ngrep "did not conform" "$HOME"/stderr
6868
'
6969

7070
test_expect_success 'UTF-8 non-characters refused' '
@@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' '
7373
printf "Commit message\n\nNon-character:\357\267\220\n" \
7474
>"$HOME/invalid" &&
7575
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
76-
grep "did not conform" "$HOME"/stderr
76+
test_i18ngrep "did not conform" "$HOME"/stderr
7777
'
7878

7979
for H in ISO8859-1 eucJP ISO-2022-JP

t/t3901-i18n-patch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
295295
296296
# commit-tree will warn that the commit message does not contain valid UTF-8
297297
# as mailinfo did not convert it
298-
grep "did not conform" err &&
298+
test_i18ngrep "did not conform" err &&
299299
300300
check_encoding 2
301301
'

t/t5512-ls-remote.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
9999
# We could just as easily have used "master"; the "*" emphasizes its
100100
# role as a pattern.
101101
test_must_fail git ls-remote refs*master >actual 2>&1 &&
102-
test_cmp exp actual
102+
test_i18ncmp exp actual
103103
'
104104

105105
test_expect_success 'die with non-2 for wrong repository even with --exit-code' '

0 commit comments

Comments
 (0)