i18n: rebase-interactive: mark strings for translation
Mark strings in git-rebase--interactive.sh for translation. There is no need to source git-sh-i18n since git-rebase.sh already does so. Add git-rebase--interactive.sh to LOCALIZED_SH in Makefile in order to enable extracting strings marked for translation by xgettext. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vasco Almeida committed
Jun 17, 2016 at 20:21 UTC
9588c52b75c6ec9cc75b045cdec4fe237038615b
2 files changed
+102
-90
Makefile
+1
@@ -2064,6 +2064,7 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
2064
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
2065
LOCALIZED_SH = $(SCRIPT_SH)
2066
LOCALIZED_SH += git-parse-remote.sh
2067
+LOCALIZED_SH += git-rebase--interactive.sh
2068
LOCALIZED_SH += git-sh-setup.sh
2069
LOCALIZED_PERL = $(SCRIPT_PERL)
2070
git-rebase--interactive.sh
+101
-90
@@ -128,7 +128,7 @@ mark_action_done () {
128
if test "$last_count" != "$new_count"
129
then
130
last_count=$new_count
131
- printf "Rebasing (%d/%d)\r" $new_count $total
131
+ eval_gettext "Rebasing (\$new_count/\$total)"; printf "\r"
132
test -z "$verbose" || echo
133
fi
134
}
@@ -201,13 +201,14 @@ exit_with_patch () {
201
make_patch $1
202
git rev-parse --verify HEAD > "$amend"
203
gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")}
204
- warn "You can amend the commit now, with"
205
- warn
206
- warn " git commit --amend $gpg_sign_opt_quoted"
207
- warn
208
- warn "Once you are satisfied with your changes, run"
209
- warn
210
- warn " git rebase --continue"
204
+ warn "$(eval_gettext "\
205
+You can amend the commit now, with
206
+
207
+ git commit --amend \$gpg_sign_opt_quoted
208
+
209
+Once you are satisfied with your changes, run
210
+
211
+ git rebase --continue")"
212
warn
213
exit $2
214
}
@@ -222,10 +223,12 @@ has_action () {
223
}
224
225
is_empty_commit() {
225
- tree=$(git rev-parse -q --verify "$1"^{tree} 2>/dev/null ||
226
- die "$1: not a commit that can be picked")
227
- ptree=$(git rev-parse -q --verify "$1"^^{tree} 2>/dev/null ||
228
- ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)
226
+ tree=$(git rev-parse -q --verify "$1"^{tree} 2>/dev/null) || {
227
+ sha1=$1
228
+ die "$(eval_gettext "\$sha1: not a commit that can be picked")"
229
+ }
230
+ ptree=$(git rev-parse -q --verify "$1"^^{tree} 2>/dev/null) ||
231
+ ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
232
test "$tree" = "$ptree"
233
}
234
@@ -261,7 +264,7 @@ pick_one () {
264
265
case "$1" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac
266
case "$force_rebase" in '') ;; ?*) ff= ;; esac
264
- output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
267
+ output git rev-parse --verify $sha1 || die "$(eval_gettext "Invalid commit name: \$sha1")"
268
269
if is_empty_commit "$sha1"
270
then
@@ -303,7 +306,7 @@ pick_one_preserving_merges () {
306
git rev-parse HEAD > "$rewritten"/$current_commit
307
done <"$state_dir"/current-commit
308
rm "$state_dir"/current-commit ||
306
- die "Cannot write current commit's replacement sha1"
309
+ die "$(gettext "Cannot write current commit's replacement sha1")"
310
fi
311
fi
312
@@ -355,9 +358,9 @@ pick_one_preserving_merges () {
358
done
359
case $fast_forward in
360
t)
358
- output warn "Fast-forward to $sha1"
361
+ output warn "$(eval_gettext "Fast-forward to \$sha1")"
362
output git reset --hard $sha1 ||
360
- die "Cannot fast-forward to $sha1"
363
+ die "$(eval_gettext "Cannot fast-forward to \$sha1")"
364
;;
365
f)
366
first_parent=$(expr "$new_parents" : ' \([^ ]*\)')
@@ -366,12 +369,12 @@ pick_one_preserving_merges () {
369
then
370
# detach HEAD to current parent
371
output git checkout $first_parent 2> /dev/null ||
369
- die "Cannot move HEAD to $first_parent"
372
+ die "$(eval_gettext "Cannot move HEAD to \$first_parent")"
373
fi
374
375
case "$new_parents" in
376
' '*' '*)
374
- test "a$1" = a-n && die "Refusing to squash a merge: $sha1"
377
+ test "a$1" = a-n && die "$(eval_gettext "Refusing to squash a merge: \$sha1")"
378
379
# redo merge
380
author_script_content=$(get_author_ident_from_commit $sha1)
@@ -385,7 +388,7 @@ pick_one_preserving_merges () {
388
$merge_args $strategy_args -m "$msg_content" $new_parents'
389
then
390
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
388
- die_with_patch $sha1 "Error redoing merge $sha1"
391
+ die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")"
392
fi
393
echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list"
394
;;
@@ -393,7 +396,7 @@ pick_one_preserving_merges () {
396
output eval git cherry-pick \
397
${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \
398
"$strategy_args" "$@" ||
396
- die_with_patch $sha1 "Could not pick $sha1"
399
+ die_with_patch $sha1 "$(eval_gettext "Could not pick \$sha1")"
400
;;
401
esac
402
;;
@@ -460,12 +463,14 @@ peek_next_command () {
463
# messages, effectively causing the combined commit to be used as the
464
# new basis for any further squash/fixups. Args: sha1 rest
465
die_failed_squash() {
466
+ sha1=$1
467
+ rest=$2
468
mv "$squash_msg" "$msg" || exit
469
rm -f "$fixup_msg"
470
cp "$msg" "$GIT_DIR"/MERGE_MSG || exit
471
warn
467
- warn "Could not apply $1... $2"
468
- die_with_patch $1 ""
472
+ warn "$(eval_gettext "Could not apply \$sha1... \$rest")"
473
+ die_with_patch $sha1 ""
474
}
475
476
flush_rewritten_pending() {
@@ -489,6 +494,8 @@ record_in_rewritten() {
494
}
495
496
do_pick () {
497
+ sha1=$1
498
+ rest=$2
499
if test "$(git rev-parse HEAD)" = "$squash_onto"
500
then
501
# Set the correct commit message and author info on the
@@ -500,15 +507,15 @@ do_pick () {
507
# resolve before manually running git commit --amend then git
508
# rebase --continue.
509
git commit --allow-empty --allow-empty-message --amend \
503
- --no-post-rewrite -n -q -C $1 &&
504
- pick_one -n $1 &&
510
+ --no-post-rewrite -n -q -C $sha1 &&
511
+ pick_one -n $sha1 &&
512
git commit --allow-empty --allow-empty-message \
506
- --amend --no-post-rewrite -n -q -C $1 \
513
+ --amend --no-post-rewrite -n -q -C $sha1 \
514
${gpg_sign_opt:+"$gpg_sign_opt"} ||
508
- die_with_patch $1 "Could not apply $1... $2"
515
+ die_with_patch $sha1 "$(eval_gettext "Could not apply \$sha1... \$rest")"
516
else
510
- pick_one $1 ||
511
- die_with_patch $1 "Could not apply $1... $2"
517
+ pick_one $sha1 ||
518
+ die_with_patch $sha1 "$(eval_gettext "Could not apply \$sha1... \$rest")"
519
fi
520
}
521
@@ -536,10 +543,11 @@ do_next () {
543
mark_action_done
544
do_pick $sha1 "$rest"
545
git commit --amend --no-post-rewrite ${gpg_sign_opt:+"$gpg_sign_opt"} || {
539
- warn "Could not amend commit after successfully picking $sha1... $rest"
540
- warn "This is most likely due to an empty commit message, or the pre-commit hook"
541
- warn "failed. If the pre-commit hook failed, you may need to resolve the issue before"
542
- warn "you are able to reword the commit."
546
+ warn "$(eval_gettext "\
547
+Could not amend commit after successfully picking \$sha1... \$rest
548
+This is most likely due to an empty commit message, or the pre-commit hook
549
+failed. If the pre-commit hook failed, you may need to resolve the issue before
550
+you are able to reword the commit.")"
551
exit_with_patch $sha1 1
552
}
553
record_in_rewritten $sha1
@@ -550,7 +558,7 @@ do_next () {
558
mark_action_done
559
do_pick $sha1 "$rest"
560
sha1_abbrev=$(git rev-parse --short $sha1)
553
- warn "Stopped at $sha1_abbrev... $rest"
561
+ warn "$(eval_gettext "Stopped at \$sha1_abbrev... \$rest")"
562
exit_with_patch $sha1 0
563
;;
564
squash|s|fixup|f)
@@ -565,7 +573,7 @@ do_next () {
573
comment_for_reflog $squash_style
574
575
test -f "$done" && has_action "$done" ||
568
- die "Cannot '$squash_style' without a previous commit"
576
+ die "$(eval_gettext "Cannot '\$squash_style' without a previous commit")"
577
578
mark_action_done
579
update_squash_messages $squash_style $sha1
@@ -607,7 +615,7 @@ do_next () {
615
x|"exec")
616
read -r command rest < "$todo"
617
mark_action_done
610
- printf 'Executing: %s\n' "$rest"
618
+ eval_gettextln "Executing: \$rest"
619
"${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
620
status=$?
621
# Run in subshell because require_clean_work_tree can die.
@@ -615,13 +623,14 @@ do_next () {
623
(require_clean_work_tree "rebase" 2>/dev/null) || dirty=t
624
if test "$status" -ne 0
625
then
618
- warn "Execution failed: $rest"
626
+ warn "$(eval_gettext "Execution failed: \$rest")"
627
test "$dirty" = f ||
620
- warn "and made changes to the index and/or the working tree"
628
+ warn "$(gettext "and made changes to the index and/or the working tree")"
629
622
- warn "You can fix the problem, and then run"
623
- warn
624
- warn " git rebase --continue"
630
+ warn "$(gettext "\
631
+You can fix the problem, and then run
632
+
633
+ git rebase --continue")"
634
warn
635
if test $status -eq 127 # command not found
636
then
@@ -630,18 +639,20 @@ do_next () {
639
exit "$status"
640
elif test "$dirty" = t
641
then
633
- warn "Execution succeeded: $rest"
634
- warn "but left changes to the index and/or the working tree"
635
- warn "Commit or stash your changes, and then run"
636
- warn
637
- warn " git rebase --continue"
642
+ # TRANSLATORS: after these lines is a command to be issued by the user
643
+ warn "$(eval_gettext "\
644
+Execution succeeded: \$rest
645
+but left changes to the index and/or the working tree
646
+Commit or stash your changes, and then run
647
+
648
+ git rebase --continue")"
649
warn
650
exit 1
651
fi
652
;;
653
*)
643
- warn "Unknown command: $command $sha1 $rest"
644
- fixtodo="Please fix this using 'git rebase --edit-todo'."
654
+ warn "$(eval_gettext "Unknown command: \$command \$sha1 \$rest")"
655
+ fixtodo="$(gettext "Please fix this using 'git rebase --edit-todo'.")"
656
if git rev-parse --verify -q "$sha1" >/dev/null
657
then
658
die_with_patch $sha1 "$fixtodo"
@@ -676,7 +687,7 @@ do_next () {
687
"$hook" rebase < "$rewritten_list"
688
true # we don't care if this hook failed
689
fi &&
679
- warn "Successfully rebased and updated $head_name."
690
+ warn "$(eval_gettext "Successfully rebased and updated \$head_name.")"
691
692
return 1 # not failure; just to break the do_rest loop
693
}
@@ -723,7 +734,7 @@ skip_unnecessary_picks () {
734
record_in_rewritten "$onto"
735
;;
736
esac ||
726
- die "Could not skip unnecessary pick commands"
737
+ die "$(gettext "Could not skip unnecessary pick commands")"
738
}
739
740
transform_todo_ids () {
@@ -881,9 +892,9 @@ check_commit_sha () {
892
if test $badsha -ne 0
893
then
894
line="$(sed -n -e "${2}p" "$3")"
884
- warn "Warning: the SHA-1 is missing or isn't" \
885
- "a commit in the following line:"
886
- warn " - $line"
895
+ warn "$(eval_gettext "\
896
+Warning: the SHA-1 is missing or isn't a commit in the following line:
897
+ - \$line")"
898
warn
899
fi
900
@@ -914,9 +925,9 @@ check_bad_cmd_and_sha () {
925
;;
926
*)
927
line="$(sed -n -e "${lineno}p" "$1")"
917
- warn "Warning: the command isn't recognized" \
918
- "in the following line:"
919
- warn " - $line"
928
+ warn "$(eval_gettext "\
929
+Warning: the command isn't recognized in the following line:
930
+ - \$line")"
931
warn
932
retval=1
933
;;
@@ -953,7 +964,7 @@ warn_lines () {
964
# Switch to the branch in $into and notify it in the reflog
965
checkout_onto () {
966
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
956
- output git checkout $onto || die_abort "could not detach HEAD"
967
+ output git checkout $onto || die_abort "$(gettext "could not detach HEAD")"
968
git update-ref ORIG_HEAD $orig_head
969
}
970
@@ -991,28 +1002,26 @@ check_todo_list () {
1002
then
1003
test "$check_level" = error && raise_error=t
1004
994
- warn "Warning: some commits may have been dropped" \
995
- "accidentally."
996
- warn "Dropped commits (newer to older):"
1005
+ warn "$(gettext "\
1006
+Warning: some commits may have been dropped accidentally.
1007
+Dropped commits (newer to older):")"
1008
1009
# Make the list user-friendly and display
1010
opt="--no-walk=sorted --format=oneline --abbrev-commit --stdin"
1011
git rev-list $opt <"$todo".miss | warn_lines
1012
1002
- warn "To avoid this message, use \"drop\" to" \
1003
- "explicitly remove a commit."
1004
- warn
1005
- warn "Use 'git config rebase.missingCommitsCheck' to change" \
1006
- "the level of warnings."
1007
- warn "The possible behaviours are: ignore, warn, error."
1013
+ warn "$(gettext "\
1014
+To avoid this message, use \"drop\" to explicitly remove a commit.
1015
+
1016
+Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
1017
+The possible behaviours are: ignore, warn, error.")"
1018
warn
1019
fi
1020
;;
1021
ignore)
1022
;;
1023
*)
1014
- warn "Unrecognized setting $check_level for option" \
1015
- "rebase.missingCommitsCheck. Ignoring."
1024
+ warn "$(eval_gettext "Unrecognized setting \$check_level for option rebase.missingCommitsCheck. Ignoring.")"
1025
;;
1026
esac
1027
@@ -1029,8 +1038,8 @@ check_todo_list () {
1038
# placed before the commit of the next action
1039
checkout_onto
1040
1032
- warn "You can fix this with 'git rebase --edit-todo'."
1033
- die "Or you can abort the rebase with 'git rebase --abort'."
1041
+ warn "$(gettext "You can fix this with 'git rebase --edit-todo'.")"
1042
+ die "$(gettext "Or you can abort the rebase with 'git rebase --abort'.")"
1043
fi
1044
}
1045
@@ -1054,41 +1063,43 @@ continue)
1063
1064
test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD ||
1065
rm "$GIT_DIR"/CHERRY_PICK_HEAD ||
1057
- die "Could not remove CHERRY_PICK_HEAD"
1066
+ die "$(gettext "Could not remove CHERRY_PICK_HEAD")"
1067
else
1068
if ! test -f "$author_script"
1069
then
1070
gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")}
1062
- die "You have staged changes in your working tree. If these changes are meant to be
1071
+ die "$(eval_gettext "\
1072
+You have staged changes in your working tree.
1073
+If these changes are meant to be
1074
squashed into the previous commit, run:
1075
1065
- git commit --amend $gpg_sign_opt_quoted
1076
+ git commit --amend \$gpg_sign_opt_quoted
1077
1078
If they are meant to go into a new commit, run:
1079
1069
- git commit $gpg_sign_opt_quoted
1080
+ git commit \$gpg_sign_opt_quoted
1081
1082
In both case, once you're done, continue with:
1083
1084
git rebase --continue
1074
-"
1085
+")"
1086
fi
1087
. "$author_script" ||
1077
- die "Error trying to find the author identity to amend commit"
1088
+ die "$(gettext "Error trying to find the author identity to amend commit")"
1089
if test -f "$amend"
1090
then
1091
current_head=$(git rev-parse --verify HEAD)
1092
test "$current_head" = $(cat "$amend") ||
1082
- die "\
1083
-You have uncommitted changes in your working tree. Please, commit them
1084
-first and then run 'git rebase --continue' again."
1093
+ die "$(gettext "\
1094
+You have uncommitted changes in your working tree. Please commit them
1095
+first and then run 'git rebase --continue' again.")"
1096
do_with_author git commit --amend --no-verify -F "$msg" -e \
1097
${gpg_sign_opt:+"$gpg_sign_opt"} ||
1087
- die "Could not commit staged changes."
1098
+ die "$(gettext "Could not commit staged changes.")"
1099
else
1100
do_with_author git commit --no-verify -F "$msg" -e \
1101
${gpg_sign_opt:+"$gpg_sign_opt"} ||
1091
- die "Could not commit staged changes."
1102
+ die "$(gettext "Could not commit staged changes.")"
1103
fi
1104
fi
1105
@@ -1121,7 +1132,7 @@ To continue rebase after editing, run:
1132
EOF
1133
1134
git_sequence_editor "$todo" ||
1124
- die "Could not execute editor"
1135
+ die "$(gettext "Could not execute editor")"
1136
expand_todo_ids
1137
1138
exit
@@ -1129,7 +1140,7 @@ EOF
1140
esac
1141
1142
git var GIT_COMMITTER_IDENT >/dev/null ||
1132
- die "You need to set your committer info first"
1143
+ die "$(gettext "You need to set your committer info first")"
1144
1145
comment_for_reflog start
1146
@@ -1137,15 +1148,15 @@ if test ! -z "$switch_to"
1148
then
1149
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to"
1150
output git checkout "$switch_to" -- ||
1140
- die "Could not checkout $switch_to"
1151
+ die "$(eval_gettext "Could not checkout \$switch_to")"
1152
1153
comment_for_reflog start
1154
fi
1155
1145
-orig_head=$(git rev-parse --verify HEAD) || die "No HEAD?"
1146
-mkdir -p "$state_dir" || die "Could not create temporary $state_dir"
1156
+orig_head=$(git rev-parse --verify HEAD) || die "$(gettext "No HEAD?")"
1157
+mkdir -p "$state_dir" || die "$(eval_gettext "Could not create temporary \$state_dir")"
1158
1148
-: > "$state_dir"/interactive || die "Could not mark as interactive"
1159
+: > "$state_dir"/interactive || die "$(gettext "Could not mark as interactive")"
1160
write_basic_state
1161
if test t = "$preserve_merges"
1162
then
@@ -1155,12 +1166,12 @@ then
1166
for c in $(git merge-base --all $orig_head $upstream)
1167
do
1168
echo $onto > "$rewritten"/$c ||
1158
- die "Could not init rewritten commits"
1169
+ die "$(gettext "Could not init rewritten commits")"
1170
done
1171
else
1172
mkdir "$rewritten" &&
1173
echo $onto > "$rewritten"/root ||
1163
- die "Could not init rewritten commits"
1174
+ die "$(gettext "Could not init rewritten commits")"
1175
fi
1176
# No cherry-pick because our first pass is to determine
1177
# parents to rewrite and skipping dropped commits would
@@ -1270,7 +1281,7 @@ EOF
1281
1282
if test -z "$keep_empty"
1283
then
1273
- printf '%s\n' "$comment_char Note that empty commits are commented out" >>"$todo"
1284
+ printf '%s\n' "$comment_char $(gettext "Note that empty commits are commented out")" >>"$todo"
1285
fi
1286
1287
@@ -1280,7 +1291,7 @@ has_action "$todo" ||
1291
cp "$todo" "$todo".backup
1292
collapse_todo_ids
1293
git_sequence_editor "$todo" ||
1283
- die_abort "Could not execute editor"
1294
+ die_abort "$(gettext "Could not execute editor")"
1295
1296
has_action "$todo" ||
1297
return 2