Skip to content

Commit dd4c0ce

Browse files
committed
Merge branch 'ab/i18n-fixup' into maint
* ab/i18n-fixup: (24 commits) i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811 i18n: use test_i18n{grep,cmp} in t7508 i18n: use test_i18ngrep in t7506 i18n: use test_i18ngrep and test_i18ncmp in t7502 i18n: use test_i18ngrep in t7501 i18n: use test_i18ncmp in t7500 i18n: use test_i18ngrep in t7201 i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110 i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060 i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014 i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507 i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200 i18n: use test_i18ngrep in lib-httpd and t2019 i18n: do not overuse C_LOCALE_OUTPUT (grep) i18n: use test_i18ncmp in t1200 and t2200 i18n: .git file is not a human readable message (t5601) i18n: do not overuse C_LOCALE_OUTPUT i18n: mark init-db messages for translation i18n: mark checkout plural warning for translation i18n: mark checkout --detach messages for translation ...
2 parents b3c8931 + c9ea118 commit dd4c0ce

40 files changed

+375
-383
lines changed

builtin/checkout.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,18 +648,30 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
648648
if (more == 1)
649649
describe_one_orphan(&sb, last);
650650
else
651-
strbuf_addf(&sb, " ... and %d more.\n", more);
651+
strbuf_addf(&sb, _(" ... and %d more.\n"), more);
652652
}
653653

654654
fprintf(stderr,
655-
"Warning: you are leaving %d commit%s behind, "
655+
Q_(
656+
/* The singular version */
657+
"Warning: you are leaving %d commit behind, "
658+
"not connected to\n"
659+
"any of your branches:\n\n"
660+
"%s\n"
661+
"If you want to keep it by creating a new branch, "
662+
"this may be a good time\nto do so with:\n\n"
663+
" git branch new_branch_name %s\n\n",
664+
/* The plural version */
665+
"Warning: you are leaving %d commits behind, "
656666
"not connected to\n"
657667
"any of your branches:\n\n"
658668
"%s\n"
659669
"If you want to keep them by creating a new branch, "
660670
"this may be a good time\nto do so with:\n\n"
661671
" git branch new_branch_name %s\n\n",
662-
lost, ((1 < lost) ? "s" : ""),
672+
/* Give ngettext() the count */
673+
lost),
674+
lost,
663675
sb.buf,
664676
sha1_to_hex(commit->object.sha1));
665677
strbuf_release(&sb);
@@ -961,9 +973,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
961973
die (_("--patch is incompatible with all other options"));
962974

963975
if (opts.force_detach && (opts.new_branch || opts.new_orphan_branch))
964-
die("--detach cannot be used with -b/-B/--orphan");
976+
die(_("--detach cannot be used with -b/-B/--orphan"));
965977
if (opts.force_detach && 0 < opts.track)
966-
die("--detach cannot be used with -t");
978+
die(_("--detach cannot be used with -t"));
967979

968980
/* --track without -b should DWIM */
969981
if (0 < opts.track && !opts.new_branch) {
@@ -1043,7 +1055,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
10431055
}
10441056

10451057
if (opts.force_detach)
1046-
die("git checkout: --detach does not take a path argument");
1058+
die(_("git checkout: --detach does not take a path argument"));
10471059

10481060
if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
10491061
die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
417417
if (path)
418418
repo = xstrdup(absolute_path(repo_name));
419419
else if (!strchr(repo_name, ':'))
420-
die("repository '%s' does not exist", repo_name);
420+
die(_("repository '%s' does not exist"), repo_name);
421421
else
422422
repo = repo_name;
423423
is_local = path && !is_bundle;

builtin/init-db.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,
319319
struct stat st;
320320

321321
if (!exist_ok && !stat(git_dir, &st))
322-
die("%s already exists", git_dir);
322+
die(_("%s already exists"), git_dir);
323323

324324
if (!exist_ok && !stat(real_git_dir, &st))
325-
die("%s already exists", real_git_dir);
325+
die(_("%s already exists"), real_git_dir);
326326

327327
/*
328328
* make sure symlinks are resolved because we'll be
@@ -351,15 +351,15 @@ static void separate_git_dir(const char *git_dir)
351351
else if (S_ISDIR(st.st_mode))
352352
src = git_link;
353353
else
354-
die("unable to handle file type %d", st.st_mode);
354+
die(_("unable to handle file type %d"), st.st_mode);
355355

356356
if (rename(src, git_dir))
357-
die_errno("unable to move %s to %s", src, git_dir);
357+
die_errno(_("unable to move %s to %s"), src, git_dir);
358358
}
359359

360360
fp = fopen(git_link, "w");
361361
if (!fp)
362-
die("Could not create git link %s", git_link);
362+
die(_("Could not create git link %s"), git_link);
363363
fprintf(fp, "gitdir: %s\n", git_dir);
364364
fclose(fp);
365365
}

builtin/merge.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ static void read_merge_msg(void)
839839
{
840840
strbuf_reset(&merge_msg);
841841
if (strbuf_read_file(&merge_msg, git_path("MERGE_MSG"), 0) < 0)
842-
die_errno("Could not read from '%s'", git_path("MERGE_MSG"));
842+
die_errno(_("Could not read from '%s'"), git_path("MERGE_MSG"));
843843
}
844844

845845
static void run_prepare_commit_msg(void)
@@ -979,16 +979,16 @@ static int setup_with_upstream(const char ***argv)
979979
const char **args;
980980

981981
if (!branch)
982-
die("No current branch.");
982+
die(_("No current branch."));
983983
if (!branch->remote)
984-
die("No remote for the current branch.");
984+
die(_("No remote for the current branch."));
985985
if (!branch->merge_nr)
986-
die("No default upstream defined for the current branch.");
986+
die(_("No default upstream defined for the current branch."));
987987

988988
args = xcalloc(branch->merge_nr + 1, sizeof(char *));
989989
for (i = 0; i < branch->merge_nr; i++) {
990990
if (!branch->merge[i]->dst)
991-
die("No remote tracking branch for %s from %s",
991+
die(_("No remote tracking branch for %s from %s"),
992992
branch->merge[i]->src, branch->remote_name);
993993
args[i] = branch->merge[i]->dst;
994994
}
@@ -1062,10 +1062,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
10621062
}
10631063
if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
10641064
if (advice_resolve_conflict)
1065-
die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
1066-
"Please, commit your changes before you can merge.");
1065+
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
1066+
"Please, commit your changes before you can merge."));
10671067
else
1068-
die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).");
1068+
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)."));
10691069
}
10701070
resolve_undo_clear();
10711071

t/lib-httpd.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ test_http_push_nonff() {
157157
grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
158158
'
159159

160-
test_expect_success C_LOCALE_OUTPUT 'non-fast-forward push shows help message' '
161-
grep "To prevent you from losing history, non-fast-forward updates were rejected" \
162-
output
160+
test_expect_success 'non-fast-forward push shows help message' '
161+
test_i18ngrep "To prevent you from losing history, non-fast-forward updates were rejected" output
163162
'
164163
}

t/t0001-init.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
180180
fi
181181
'
182182

183-
test_expect_success C_LOCALE_OUTPUT 'reinit' '
183+
test_expect_success 'reinit' '
184184
185185
(
186186
sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
@@ -190,11 +190,11 @@ test_expect_success C_LOCALE_OUTPUT 'reinit' '
190190
git init >out1 2>err1 &&
191191
git init >out2 2>err2
192192
) &&
193-
grep "Initialized empty" again/out1 &&
194-
grep "Reinitialized existing" again/out2 &&
193+
test_i18ngrep "Initialized empty" again/out1 &&
194+
test_i18ngrep "Reinitialized existing" again/out2 &&
195195
>again/empty &&
196-
test_cmp again/empty again/err1 &&
197-
test_cmp again/empty again/err2
196+
test_i18ncmp again/empty again/err1 &&
197+
test_i18ncmp again/empty again/err2
198198
'
199199

200200
test_expect_success 'init with --template' '

t/t1200-tutorial.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ test_expect_success 'git resolve' '
166166
-e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output
167167
'
168168

169-
test_expect_success C_LOCALE_OUTPUT 'git resolve output' '
170-
test_cmp resolve.expect resolve.output
169+
test_expect_success 'git resolve output' '
170+
test_i18ncmp resolve.expect resolve.output
171171
'
172172

173173
cat > show-branch2.expect << EOF

t/t2019-checkout-ambiguous-ref.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ test_expect_success 'checkout chooses branch over tag' '
2929
test_cmp expect file
3030
'
3131

32-
test_expect_success C_LOCALE_OUTPUT 'checkout reports switch to branch' '
33-
grep "Switched to branch" stderr &&
34-
! grep "^HEAD is now at" stderr
32+
test_expect_success 'checkout reports switch to branch' '
33+
test_i18ngrep "Switched to branch" stderr &&
34+
test_i18ngrep ! "^HEAD is now at" stderr
3535
'
3636

3737
test_expect_success 'checkout vague ref succeeds' '
@@ -51,9 +51,9 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
5151
test_cmp expect file
5252
'
5353

54-
test_expect_success VAGUENESS_SUCCESS,C_LOCALE_OUTPUT 'checkout reports switch to branch' '
55-
grep "Switched to branch" stderr &&
56-
! grep "^HEAD is now at" stderr
54+
test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
55+
test_i18ngrep "Switched to branch" stderr &&
56+
test_i18ngrep ! "^HEAD is now at" stderr
5757
'
5858

5959
test_done

t/t2020-checkout-detach.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ check_not_detached () {
1313

1414
ORPHAN_WARNING='you are leaving .* commit.*behind'
1515
check_orphan_warning() {
16-
grep "$ORPHAN_WARNING" "$1"
16+
test_i18ngrep "$ORPHAN_WARNING" "$1"
1717
}
1818
check_no_orphan_warning() {
19-
! grep "$ORPHAN_WARNING" "$1"
19+
test_i18ngrep ! "$ORPHAN_WARNING" "$1"
2020
}
2121

2222
reset () {
@@ -108,21 +108,30 @@ test_expect_success 'checkout warns on orphan commits' '
108108
echo content >orphan &&
109109
git add orphan &&
110110
git commit -a -m orphan &&
111-
git checkout master 2>stderr &&
111+
git checkout master 2>stderr
112+
'
113+
114+
test_expect_success 'checkout warns on orphan commits: output' '
112115
check_orphan_warning stderr
113116
'
114117

115118
test_expect_success 'checkout does not warn leaving ref tip' '
116119
reset &&
117120
git checkout --detach two &&
118-
git checkout master 2>stderr &&
121+
git checkout master 2>stderr
122+
'
123+
124+
test_expect_success 'checkout does not warn leaving ref tip' '
119125
check_no_orphan_warning stderr
120126
'
121127

122128
test_expect_success 'checkout does not warn leaving reachable commit' '
123129
reset &&
124130
git checkout --detach HEAD^ &&
125-
git checkout master 2>stderr &&
131+
git checkout master 2>stderr
132+
'
133+
134+
test_expect_success 'checkout does not warn leaving reachable commit' '
126135
check_no_orphan_warning stderr
127136
'
128137

t/t2200-add-update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test_expect_success 'touch and then add explicitly' '
111111
112112
'
113113

114-
test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' '
114+
test_expect_success 'add -n -u should not add but just report' '
115115
116116
(
117117
echo "add '\''check'\''" &&
@@ -124,7 +124,7 @@ test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' '
124124
after=$(git ls-files -s check top) &&
125125
126126
test "$before" = "$after" &&
127-
test_cmp expect actual
127+
test_i18ncmp expect actual
128128
129129
'
130130

0 commit comments

Comments
 (0)