Skip to content

Commit b262b8f

Browse files
committed
Merge branch 'va/i18n-misc-updates' into maint
Mark several messages for translation. * va/i18n-misc-updates: i18n: unpack-trees: avoid substituting only a verb in sentences i18n: builtin/pull.c: split strings marked for translation i18n: builtin/pull.c: mark placeholders for translation i18n: git-parse-remote.sh: mark strings for translation i18n: branch: move comment for translators i18n: branch: unmark string for translation i18n: builtin/rm.c: remove a comma ',' from string i18n: unpack-trees: mark strings for translation i18n: builtin/branch.c: mark option for translation i18n: index-pack: use plural string instead of normal one
2 parents 57b76d3 + 2e3926b commit b262b8f

File tree

8 files changed

+111
-61
lines changed

8 files changed

+111
-61
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
20632063
--keyword=gettextln --keyword=eval_gettextln
20642064
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
20652065
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
2066-
LOCALIZED_SH = $(SCRIPT_SH)
2066+
LOCALIZED_SH = $(SCRIPT_SH) git-parse-remote.sh
20672067
LOCALIZED_PERL = $(SCRIPT_PERL)
20682068

20692069
ifdef XGETTEXT_INCLUDE_TESTS

builtin/branch.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,14 @@ static char *get_head_description(void)
375375
strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
376376
state.branch);
377377
else if (state.detached_from) {
378-
/* TRANSLATORS: make sure these match _("HEAD detached at ")
379-
and _("HEAD detached from ") in wt-status.c */
380378
if (state.detached_at)
379+
/* TRANSLATORS: make sure this matches
380+
"HEAD detached at " in wt-status.c */
381381
strbuf_addf(&desc, _("(HEAD detached at %s)"),
382382
state.detached_from);
383383
else
384+
/* TRANSLATORS: make sure this matches
385+
"HEAD detached from " in wt-status.c */
384386
strbuf_addf(&desc, _("(HEAD detached from %s)"),
385387
state.detached_from);
386388
}
@@ -630,7 +632,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
630632
BRANCH_TRACK_EXPLICIT),
631633
OPT_SET_INT( 0, "set-upstream", &track, N_("change upstream info"),
632634
BRANCH_TRACK_OVERRIDE),
633-
OPT_STRING('u', "set-upstream-to", &new_upstream, "upstream", "change the upstream info"),
635+
OPT_STRING('u', "set-upstream-to", &new_upstream, N_("upstream"), N_("change the upstream info")),
634636
OPT_BOOL(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
635637
OPT__COLOR(&branch_use_color, N_("use colored output")),
636638
OPT_SET_INT('r', "remotes", &filter.kind, N_("act on remote-tracking branches"),
@@ -838,8 +840,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
838840
if (argc == 1 && track == BRANCH_TRACK_OVERRIDE &&
839841
!branch_existed && remote_tracking) {
840842
fprintf(stderr, _("\nIf you wanted to make '%s' track '%s', do this:\n\n"), head, branch->name);
841-
fprintf(stderr, _(" git branch -d %s\n"), branch->name);
842-
fprintf(stderr, _(" git branch --set-upstream-to %s\n"), branch->name);
843+
fprintf(stderr, " git branch -d %s\n", branch->name);
844+
fprintf(stderr, " git branch --set-upstream-to %s\n", branch->name);
843845
}
844846

845847
} else

builtin/index-pack.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,9 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
12501250
nr_unresolved * sizeof(*objects));
12511251
f = sha1fd(output_fd, curr_pack);
12521252
fix_unresolved_deltas(f);
1253-
strbuf_addf(&msg, _("completed with %d local objects"),
1253+
strbuf_addf(&msg, Q_("completed with %d local object",
1254+
"completed with %d local objects",
1255+
nr_objects - nr_objects_initial),
12541256
nr_objects - nr_objects_initial);
12551257
stop_progress_msg(&progress, msg.buf);
12561258
strbuf_release(&msg);

builtin/pull.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,13 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
458458
fprintf_ln(stderr, _("Please specify which branch you want to merge with."));
459459
fprintf_ln(stderr, _("See git-pull(1) for details."));
460460
fprintf(stderr, "\n");
461-
fprintf_ln(stderr, " git pull <remote> <branch>");
461+
fprintf_ln(stderr, " git pull %s %s", _("<remote>"), _("<branch>"));
462462
fprintf(stderr, "\n");
463463
} else if (!curr_branch->merge_nr) {
464464
const char *remote_name = NULL;
465465

466466
if (for_each_remote(get_only_remote, &remote_name) || !remote_name)
467-
remote_name = "<remote>";
467+
remote_name = _("<remote>");
468468

469469
fprintf_ln(stderr, _("There is no tracking information for the current branch."));
470470
if (opt_rebase)
@@ -473,12 +473,12 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
473473
fprintf_ln(stderr, _("Please specify which branch you want to merge with."));
474474
fprintf_ln(stderr, _("See git-pull(1) for details."));
475475
fprintf(stderr, "\n");
476-
fprintf_ln(stderr, " git pull <remote> <branch>");
476+
fprintf_ln(stderr, " git pull %s %s", _("<remote>"), _("<branch>"));
477477
fprintf(stderr, "\n");
478-
fprintf_ln(stderr, _("If you wish to set tracking information for this branch you can do so with:\n"
479-
"\n"
480-
" git branch --set-upstream-to=%s/<branch> %s\n"),
481-
remote_name, curr_branch->name);
478+
fprintf_ln(stderr, _("If you wish to set tracking information for this branch you can do so with:"));
479+
fprintf(stderr, "\n");
480+
fprintf_ln(stderr, " git branch --set-upstream-to=%s/%s %s\n",
481+
remote_name, _("<branch>"), curr_branch->name);
482482
} else
483483
fprintf_ln(stderr, _("Your configuration specifies to merge with the ref '%s'\n"
484484
"from the remote, but no such ref was fetched."),

builtin/rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
314314
list.entry[list.nr].is_submodule = S_ISGITLINK(ce->ce_mode);
315315
if (list.entry[list.nr++].is_submodule &&
316316
!is_staging_gitmodules_ok())
317-
die (_("Please, stage your changes to .gitmodules or stash them to proceed"));
317+
die (_("Please stage your changes to .gitmodules or stash them to proceed"));
318318
}
319319

320320
if (pathspec.nr) {

git-parse-remote.sh

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,46 @@ get_remote_merge_branch () {
5656
error_on_missing_default_upstream () {
5757
cmd="$1"
5858
op_type="$2"
59-
op_prep="$3"
59+
op_prep="$3" # FIXME: op_prep is no longer used
6060
example="$4"
6161
branch_name=$(git symbolic-ref -q HEAD)
62+
display_branch_name="${branch_name#refs/heads/}"
6263
# If there's only one remote, use that in the suggestion
63-
remote="<remote>"
64+
remote="$(gettext "<remote>")"
65+
branch="$(gettext "<branch>")"
6466
if test $(git remote | wc -l) = 1
6567
then
6668
remote=$(git remote)
6769
fi
6870

6971
if test -z "$branch_name"
7072
then
71-
echo "You are not currently on a branch. Please specify which
72-
branch you want to $op_type $op_prep. See git-${cmd}(1) for details.
73-
74-
$example
75-
"
73+
gettextln "You are not currently on a branch."
7674
else
77-
echo "There is no tracking information for the current branch.
78-
Please specify which branch you want to $op_type $op_prep.
79-
See git-${cmd}(1) for details
80-
81-
$example
82-
83-
If you wish to set tracking information for this branch you can do so with:
84-
85-
git branch --set-upstream-to=$remote/<branch> ${branch_name#refs/heads/}
86-
"
75+
gettextln "There is no tracking information for the current branch."
76+
fi
77+
case "$op_type" in
78+
rebase)
79+
gettextln "Please specify which branch you want to rebase against."
80+
;;
81+
merge)
82+
gettextln "Please specify which branch you want to merge with."
83+
;;
84+
*)
85+
echo >&2 "BUG: unknown operation type: $op_type"
86+
exit 1
87+
;;
88+
esac
89+
eval_gettextln "See git-\${cmd}(1) for details."
90+
echo
91+
echo " $example"
92+
echo
93+
if test -n "$branch_name"
94+
then
95+
gettextln "If you wish to set tracking information for this branch you can do so with:"
96+
echo
97+
echo " git branch --set-upstream-to=$remote/$branch $display_branch_name"
98+
echo
8799
fi
88100
exit 1
89101
}

t/t7609-merge-co-error-msgs.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ EOF
3737

3838
test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
3939
test_must_fail git merge branch 2>out &&
40-
test_cmp out expect &&
40+
test_i18ncmp out expect &&
4141
git commit --allow-empty -m empty &&
4242
(
4343
GIT_MERGE_VERBOSITY=0 &&
4444
export GIT_MERGE_VERBOSITY &&
4545
test_must_fail git merge branch 2>out2
4646
) &&
47-
test_cmp out2 expect &&
47+
test_i18ncmp out2 expect &&
4848
git reset --hard HEAD^
4949
'
5050

@@ -53,7 +53,7 @@ error: Your local changes to the following files would be overwritten by merge:
5353
four
5454
three
5555
two
56-
Please, commit your changes or stash them before you can merge.
56+
Please commit your changes or stash them before you can merge.
5757
error: The following untracked working tree files would be overwritten by merge:
5858
five
5959
Please move or remove them before you can merge.
@@ -65,14 +65,14 @@ test_expect_success 'untracked files or local changes ovewritten by merge' '
6565
git add three &&
6666
git add four &&
6767
test_must_fail git merge branch 2>out &&
68-
test_cmp out expect
68+
test_i18ncmp out expect
6969
'
7070

7171
cat >expect <<\EOF
7272
error: Your local changes to the following files would be overwritten by checkout:
7373
rep/one
7474
rep/two
75-
Please, commit your changes or stash them before you can switch branches.
75+
Please commit your changes or stash them before you can switch branches.
7676
Aborting
7777
EOF
7878

@@ -87,21 +87,21 @@ test_expect_success 'cannot switch branches because of local changes' '
8787
echo uno >rep/one &&
8888
echo dos >rep/two &&
8989
test_must_fail git checkout branch 2>out &&
90-
test_cmp out expect
90+
test_i18ncmp out expect
9191
'
9292

9393
cat >expect <<\EOF
9494
error: Your local changes to the following files would be overwritten by checkout:
9595
rep/one
9696
rep/two
97-
Please, commit your changes or stash them before you can switch branches.
97+
Please commit your changes or stash them before you can switch branches.
9898
Aborting
9999
EOF
100100

101101
test_expect_success 'not uptodate file porcelain checkout error' '
102102
git add rep/one rep/two &&
103103
test_must_fail git checkout branch 2>out &&
104-
test_cmp out expect
104+
test_i18ncmp out expect
105105
'
106106

107107
cat >expect <<\EOF
@@ -132,7 +132,7 @@ test_expect_success 'not_uptodate_dir porcelain checkout error' '
132132
>rep/untracked-file &&
133133
>rep2/untracked-file &&
134134
test_must_fail git checkout branch 2>out &&
135-
test_cmp out ../expect
135+
test_i18ncmp out ../expect
136136
'
137137

138138
test_done

unpack-trees.c

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,74 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
5858
int i;
5959
const char **msgs = opts->msgs;
6060
const char *msg;
61-
const char *cmd2 = strcmp(cmd, "checkout") ? cmd : "switch branches";
6261

63-
if (advice_commit_before_merge)
64-
msg = "Your local changes to the following files would be overwritten by %s:\n%%s"
65-
"Please, commit your changes or stash them before you can %s.";
62+
if (!strcmp(cmd, "checkout"))
63+
msg = advice_commit_before_merge
64+
? _("Your local changes to the following files would be overwritten by checkout:\n%%s"
65+
"Please commit your changes or stash them before you can switch branches.")
66+
: _("Your local changes to the following files would be overwritten by checkout:\n%%s");
67+
else if (!strcmp(cmd, "merge"))
68+
msg = advice_commit_before_merge
69+
? _("Your local changes to the following files would be overwritten by merge:\n%%s"
70+
"Please commit your changes or stash them before you can merge.")
71+
: _("Your local changes to the following files would be overwritten by merge:\n%%s");
6672
else
67-
msg = "Your local changes to the following files would be overwritten by %s:\n%%s";
73+
msg = advice_commit_before_merge
74+
? _("Your local changes to the following files would be overwritten by %s:\n%%s"
75+
"Please commit your changes or stash them before you can %s.")
76+
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
6877
msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] =
69-
xstrfmt(msg, cmd, cmd2);
78+
xstrfmt(msg, cmd, cmd);
7079

7180
msgs[ERROR_NOT_UPTODATE_DIR] =
72-
"Updating the following directories would lose untracked files in it:\n%s";
73-
74-
if (advice_commit_before_merge)
75-
msg = "The following untracked working tree files would be %s by %s:\n%%s"
76-
"Please move or remove them before you can %s.";
81+
_("Updating the following directories would lose untracked files in it:\n%s");
82+
83+
if (!strcmp(cmd, "checkout"))
84+
msg = advice_commit_before_merge
85+
? _("The following untracked working tree files would be removed by checkout:\n%%s"
86+
"Please move or remove them before you can switch branches.")
87+
: _("The following untracked working tree files would be removed by checkout:\n%%s");
88+
else if (!strcmp(cmd, "merge"))
89+
msg = advice_commit_before_merge
90+
? _("The following untracked working tree files would be removed by merge:\n%%s"
91+
"Please move or remove them before you can merge.")
92+
: _("The following untracked working tree files would be removed by merge:\n%%s");
7793
else
78-
msg = "The following untracked working tree files would be %s by %s:\n%%s";
79-
80-
msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = xstrfmt(msg, "removed", cmd, cmd2);
81-
msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = xstrfmt(msg, "overwritten", cmd, cmd2);
94+
msg = advice_commit_before_merge
95+
? _("The following untracked working tree files would be removed by %s:\n%%s"
96+
"Please move or remove them before you can %s.")
97+
: _("The following untracked working tree files would be removed by %s:\n%%s");
98+
msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] = xstrfmt(msg, cmd, cmd);
99+
100+
if (!strcmp(cmd, "checkout"))
101+
msg = advice_commit_before_merge
102+
? _("The following untracked working tree files would be overwritten by checkout:\n%%s"
103+
"Please move or remove them before you can switch branches.")
104+
: _("The following untracked working tree files would be overwritten by checkout:\n%%s");
105+
else if (!strcmp(cmd, "merge"))
106+
msg = advice_commit_before_merge
107+
? _("The following untracked working tree files would be overwritten by merge:\n%%s"
108+
"Please move or remove them before you can merge.")
109+
: _("The following untracked working tree files would be overwritten by merge:\n%%s");
110+
else
111+
msg = advice_commit_before_merge
112+
? _("The following untracked working tree files would be overwritten by %s:\n%%s"
113+
"Please move or remove them before you can %s.")
114+
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
115+
msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] = xstrfmt(msg, cmd, cmd);
82116

83117
/*
84118
* Special case: ERROR_BIND_OVERLAP refers to a pair of paths, we
85119
* cannot easily display it as a list.
86120
*/
87-
msgs[ERROR_BIND_OVERLAP] = "Entry '%s' overlaps with '%s'. Cannot bind.";
121+
msgs[ERROR_BIND_OVERLAP] = _("Entry '%s' overlaps with '%s'. Cannot bind.");
88122

89123
msgs[ERROR_SPARSE_NOT_UPTODATE_FILE] =
90-
"Cannot update sparse checkout: the following entries are not up-to-date:\n%s";
124+
_("Cannot update sparse checkout: the following entries are not up-to-date:\n%s");
91125
msgs[ERROR_WOULD_LOSE_ORPHANED_OVERWRITTEN] =
92-
"The following Working tree files would be overwritten by sparse checkout update:\n%s";
126+
_("The following Working tree files would be overwritten by sparse checkout update:\n%s");
93127
msgs[ERROR_WOULD_LOSE_ORPHANED_REMOVED] =
94-
"The following Working tree files would be removed by sparse checkout update:\n%s";
128+
_("The following Working tree files would be removed by sparse checkout update:\n%s");
95129

96130
opts->show_all_errors = 1;
97131
/* rejected paths may not have a static buffer */
@@ -168,7 +202,7 @@ static void display_error_msgs(struct unpack_trees_options *o)
168202
string_list_clear(rejects, 0);
169203
}
170204
if (something_displayed)
171-
fprintf(stderr, "Aborting\n");
205+
fprintf(stderr, _("Aborting\n"));
172206
}
173207

174208
/*

0 commit comments

Comments
 (0)