From 9588c52b75c6ec9cc75b045cdec4fe237038615b Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Fri, 17 Jun 2016 20:21:03 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 191 ++++++++++++++++++++++++--------------------- 1 file changed, 101 insertions(+), 90 deletions(-) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 9d2bfb7a16..078ca5b2d5 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -128,7 +128,7 @@ mark_action_done () { if test "$last_count" != "$new_count" then last_count=$new_count - printf "Rebasing (%d/%d)\r" $new_count $total + eval_gettext "Rebasing (\$new_count/\$total)"; printf "\r" test -z "$verbose" || echo fi } @@ -201,13 +201,14 @@ exit_with_patch () { make_patch $1 git rev-parse --verify HEAD > "$amend" gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} - warn "You can amend the commit now, with" - warn - warn " git commit --amend $gpg_sign_opt_quoted" - warn - warn "Once you are satisfied with your changes, run" - warn - warn " git rebase --continue" + warn "$(eval_gettext "\ +You can amend the commit now, with + + git commit --amend \$gpg_sign_opt_quoted + +Once you are satisfied with your changes, run + + git rebase --continue")" warn exit $2 } @@ -222,10 +223,12 @@ has_action () { } is_empty_commit() { - tree=$(git rev-parse -q --verify "$1"^{tree} 2>/dev/null || - die "$1: not a commit that can be picked") - ptree=$(git rev-parse -q --verify "$1"^^{tree} 2>/dev/null || - ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904) + tree=$(git rev-parse -q --verify "$1"^{tree} 2>/dev/null) || { + sha1=$1 + die "$(eval_gettext "\$sha1: not a commit that can be picked")" + } + ptree=$(git rev-parse -q --verify "$1"^^{tree} 2>/dev/null) || + ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904 test "$tree" = "$ptree" } @@ -261,7 +264,7 @@ pick_one () { case "$1" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac case "$force_rebase" in '') ;; ?*) ff= ;; esac - output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1" + output git rev-parse --verify $sha1 || die "$(eval_gettext "Invalid commit name: \$sha1")" if is_empty_commit "$sha1" then @@ -303,7 +306,7 @@ pick_one_preserving_merges () { git rev-parse HEAD > "$rewritten"/$current_commit done <"$state_dir"/current-commit rm "$state_dir"/current-commit || - die "Cannot write current commit's replacement sha1" + die "$(gettext "Cannot write current commit's replacement sha1")" fi fi @@ -355,9 +358,9 @@ pick_one_preserving_merges () { done case $fast_forward in t) - output warn "Fast-forward to $sha1" + output warn "$(eval_gettext "Fast-forward to \$sha1")" output git reset --hard $sha1 || - die "Cannot fast-forward to $sha1" + die "$(eval_gettext "Cannot fast-forward to \$sha1")" ;; f) first_parent=$(expr "$new_parents" : ' \([^ ]*\)') @@ -366,12 +369,12 @@ pick_one_preserving_merges () { then # detach HEAD to current parent output git checkout $first_parent 2> /dev/null || - die "Cannot move HEAD to $first_parent" + die "$(eval_gettext "Cannot move HEAD to \$first_parent")" fi case "$new_parents" in ' '*' '*) - test "a$1" = a-n && die "Refusing to squash a merge: $sha1" + test "a$1" = a-n && die "$(eval_gettext "Refusing to squash a merge: \$sha1")" # redo merge author_script_content=$(get_author_ident_from_commit $sha1) @@ -385,7 +388,7 @@ pick_one_preserving_merges () { $merge_args $strategy_args -m "$msg_content" $new_parents' then printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG - die_with_patch $sha1 "Error redoing merge $sha1" + die_with_patch $sha1 "$(eval_gettext "Error redoing merge \$sha1")" fi echo "$sha1 $(git rev-parse HEAD^0)" >> "$rewritten_list" ;; @@ -393,7 +396,7 @@ pick_one_preserving_merges () { output eval git cherry-pick \ ${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} \ "$strategy_args" "$@" || - die_with_patch $sha1 "Could not pick $sha1" + die_with_patch $sha1 "$(eval_gettext "Could not pick \$sha1")" ;; esac ;; @@ -460,12 +463,14 @@ peek_next_command () { # messages, effectively causing the combined commit to be used as the # new basis for any further squash/fixups. Args: sha1 rest die_failed_squash() { + sha1=$1 + rest=$2 mv "$squash_msg" "$msg" || exit rm -f "$fixup_msg" cp "$msg" "$GIT_DIR"/MERGE_MSG || exit warn - warn "Could not apply $1... $2" - die_with_patch $1 "" + warn "$(eval_gettext "Could not apply \$sha1... \$rest")" + die_with_patch $sha1 "" } flush_rewritten_pending() { @@ -489,6 +494,8 @@ record_in_rewritten() { } do_pick () { + sha1=$1 + rest=$2 if test "$(git rev-parse HEAD)" = "$squash_onto" then # Set the correct commit message and author info on the @@ -500,15 +507,15 @@ do_pick () { # resolve before manually running git commit --amend then git # rebase --continue. git commit --allow-empty --allow-empty-message --amend \ - --no-post-rewrite -n -q -C $1 && - pick_one -n $1 && + --no-post-rewrite -n -q -C $sha1 && + pick_one -n $sha1 && git commit --allow-empty --allow-empty-message \ - --amend --no-post-rewrite -n -q -C $1 \ + --amend --no-post-rewrite -n -q -C $sha1 \ ${gpg_sign_opt:+"$gpg_sign_opt"} || - die_with_patch $1 "Could not apply $1... $2" + die_with_patch $sha1 "$(eval_gettext "Could not apply \$sha1... \$rest")" else - pick_one $1 || - die_with_patch $1 "Could not apply $1... $2" + pick_one $sha1 || + die_with_patch $sha1 "$(eval_gettext "Could not apply \$sha1... \$rest")" fi } @@ -536,10 +543,11 @@ do_next () { mark_action_done do_pick $sha1 "$rest" git commit --amend --no-post-rewrite ${gpg_sign_opt:+"$gpg_sign_opt"} || { - warn "Could not amend commit after successfully picking $sha1... $rest" - warn "This is most likely due to an empty commit message, or the pre-commit hook" - warn "failed. If the pre-commit hook failed, you may need to resolve the issue before" - warn "you are able to reword the commit." + warn "$(eval_gettext "\ +Could not amend commit after successfully picking \$sha1... \$rest +This is most likely due to an empty commit message, or the pre-commit hook +failed. If the pre-commit hook failed, you may need to resolve the issue before +you are able to reword the commit.")" exit_with_patch $sha1 1 } record_in_rewritten $sha1 @@ -550,7 +558,7 @@ do_next () { mark_action_done do_pick $sha1 "$rest" sha1_abbrev=$(git rev-parse --short $sha1) - warn "Stopped at $sha1_abbrev... $rest" + warn "$(eval_gettext "Stopped at \$sha1_abbrev... \$rest")" exit_with_patch $sha1 0 ;; squash|s|fixup|f) @@ -565,7 +573,7 @@ do_next () { comment_for_reflog $squash_style test -f "$done" && has_action "$done" || - die "Cannot '$squash_style' without a previous commit" + die "$(eval_gettext "Cannot '\$squash_style' without a previous commit")" mark_action_done update_squash_messages $squash_style $sha1 @@ -607,7 +615,7 @@ do_next () { x|"exec") read -r command rest < "$todo" mark_action_done - printf 'Executing: %s\n' "$rest" + eval_gettextln "Executing: \$rest" "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution status=$? # Run in subshell because require_clean_work_tree can die. @@ -615,13 +623,14 @@ do_next () { (require_clean_work_tree "rebase" 2>/dev/null) || dirty=t if test "$status" -ne 0 then - warn "Execution failed: $rest" + warn "$(eval_gettext "Execution failed: \$rest")" test "$dirty" = f || - warn "and made changes to the index and/or the working tree" + warn "$(gettext "and made changes to the index and/or the working tree")" - warn "You can fix the problem, and then run" - warn - warn " git rebase --continue" + warn "$(gettext "\ +You can fix the problem, and then run + + git rebase --continue")" warn if test $status -eq 127 # command not found then @@ -630,18 +639,20 @@ do_next () { exit "$status" elif test "$dirty" = t then - warn "Execution succeeded: $rest" - warn "but left changes to the index and/or the working tree" - warn "Commit or stash your changes, and then run" - warn - warn " git rebase --continue" + # TRANSLATORS: after these lines is a command to be issued by the user + warn "$(eval_gettext "\ +Execution succeeded: \$rest +but left changes to the index and/or the working tree +Commit or stash your changes, and then run + + git rebase --continue")" warn exit 1 fi ;; *) - warn "Unknown command: $command $sha1 $rest" - fixtodo="Please fix this using 'git rebase --edit-todo'." + warn "$(eval_gettext "Unknown command: \$command \$sha1 \$rest")" + fixtodo="$(gettext "Please fix this using 'git rebase --edit-todo'.")" if git rev-parse --verify -q "$sha1" >/dev/null then die_with_patch $sha1 "$fixtodo" @@ -676,7 +687,7 @@ do_next () { "$hook" rebase < "$rewritten_list" true # we don't care if this hook failed fi && - warn "Successfully rebased and updated $head_name." + warn "$(eval_gettext "Successfully rebased and updated \$head_name.")" return 1 # not failure; just to break the do_rest loop } @@ -723,7 +734,7 @@ skip_unnecessary_picks () { record_in_rewritten "$onto" ;; esac || - die "Could not skip unnecessary pick commands" + die "$(gettext "Could not skip unnecessary pick commands")" } transform_todo_ids () { @@ -881,9 +892,9 @@ check_commit_sha () { if test $badsha -ne 0 then line="$(sed -n -e "${2}p" "$3")" - warn "Warning: the SHA-1 is missing or isn't" \ - "a commit in the following line:" - warn " - $line" + warn "$(eval_gettext "\ +Warning: the SHA-1 is missing or isn't a commit in the following line: + - \$line")" warn fi @@ -914,9 +925,9 @@ check_bad_cmd_and_sha () { ;; *) line="$(sed -n -e "${lineno}p" "$1")" - warn "Warning: the command isn't recognized" \ - "in the following line:" - warn " - $line" + warn "$(eval_gettext "\ +Warning: the command isn't recognized in the following line: + - \$line")" warn retval=1 ;; @@ -953,7 +964,7 @@ warn_lines () { # Switch to the branch in $into and notify it in the reflog checkout_onto () { GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" - output git checkout $onto || die_abort "could not detach HEAD" + output git checkout $onto || die_abort "$(gettext "could not detach HEAD")" git update-ref ORIG_HEAD $orig_head } @@ -991,28 +1002,26 @@ check_todo_list () { then test "$check_level" = error && raise_error=t - warn "Warning: some commits may have been dropped" \ - "accidentally." - warn "Dropped commits (newer to older):" + warn "$(gettext "\ +Warning: some commits may have been dropped accidentally. +Dropped commits (newer to older):")" # Make the list user-friendly and display opt="--no-walk=sorted --format=oneline --abbrev-commit --stdin" git rev-list $opt <"$todo".miss | warn_lines - warn "To avoid this message, use \"drop\" to" \ - "explicitly remove a commit." - warn - warn "Use 'git config rebase.missingCommitsCheck' to change" \ - "the level of warnings." - warn "The possible behaviours are: ignore, warn, error." + warn "$(gettext "\ +To avoid this message, use \"drop\" to explicitly remove a commit. + +Use 'git config rebase.missingCommitsCheck' to change the level of warnings. +The possible behaviours are: ignore, warn, error.")" warn fi ;; ignore) ;; *) - warn "Unrecognized setting $check_level for option" \ - "rebase.missingCommitsCheck. Ignoring." + warn "$(eval_gettext "Unrecognized setting \$check_level for option rebase.missingCommitsCheck. Ignoring.")" ;; esac @@ -1029,8 +1038,8 @@ check_todo_list () { # placed before the commit of the next action checkout_onto - warn "You can fix this with 'git rebase --edit-todo'." - die "Or you can abort the rebase with 'git rebase --abort'." + warn "$(gettext "You can fix this with 'git rebase --edit-todo'.")" + die "$(gettext "Or you can abort the rebase with 'git rebase --abort'.")" fi } @@ -1054,41 +1063,43 @@ continue) test ! -f "$GIT_DIR"/CHERRY_PICK_HEAD || rm "$GIT_DIR"/CHERRY_PICK_HEAD || - die "Could not remove CHERRY_PICK_HEAD" + die "$(gettext "Could not remove CHERRY_PICK_HEAD")" else if ! test -f "$author_script" then gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")} - die "You have staged changes in your working tree. If these changes are meant to be + die "$(eval_gettext "\ +You have staged changes in your working tree. +If these changes are meant to be squashed into the previous commit, run: - git commit --amend $gpg_sign_opt_quoted + git commit --amend \$gpg_sign_opt_quoted If they are meant to go into a new commit, run: - git commit $gpg_sign_opt_quoted + git commit \$gpg_sign_opt_quoted In both case, once you're done, continue with: git rebase --continue -" +")" fi . "$author_script" || - die "Error trying to find the author identity to amend commit" + die "$(gettext "Error trying to find the author identity to amend commit")" if test -f "$amend" then current_head=$(git rev-parse --verify HEAD) test "$current_head" = $(cat "$amend") || - die "\ -You have uncommitted changes in your working tree. Please, commit them -first and then run 'git rebase --continue' again." + die "$(gettext "\ +You have uncommitted changes in your working tree. Please commit them +first and then run 'git rebase --continue' again.")" do_with_author git commit --amend --no-verify -F "$msg" -e \ ${gpg_sign_opt:+"$gpg_sign_opt"} || - die "Could not commit staged changes." + die "$(gettext "Could not commit staged changes.")" else do_with_author git commit --no-verify -F "$msg" -e \ ${gpg_sign_opt:+"$gpg_sign_opt"} || - die "Could not commit staged changes." + die "$(gettext "Could not commit staged changes.")" fi fi @@ -1121,7 +1132,7 @@ To continue rebase after editing, run: EOF git_sequence_editor "$todo" || - die "Could not execute editor" + die "$(gettext "Could not execute editor")" expand_todo_ids exit @@ -1129,7 +1140,7 @@ EOF esac git var GIT_COMMITTER_IDENT >/dev/null || - die "You need to set your committer info first" + die "$(gettext "You need to set your committer info first")" comment_for_reflog start @@ -1137,15 +1148,15 @@ if test ! -z "$switch_to" then GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" output git checkout "$switch_to" -- || - die "Could not checkout $switch_to" + die "$(eval_gettext "Could not checkout \$switch_to")" comment_for_reflog start fi -orig_head=$(git rev-parse --verify HEAD) || die "No HEAD?" -mkdir -p "$state_dir" || die "Could not create temporary $state_dir" +orig_head=$(git rev-parse --verify HEAD) || die "$(gettext "No HEAD?")" +mkdir -p "$state_dir" || die "$(eval_gettext "Could not create temporary \$state_dir")" -: > "$state_dir"/interactive || die "Could not mark as interactive" +: > "$state_dir"/interactive || die "$(gettext "Could not mark as interactive")" write_basic_state if test t = "$preserve_merges" then @@ -1155,12 +1166,12 @@ then for c in $(git merge-base --all $orig_head $upstream) do echo $onto > "$rewritten"/$c || - die "Could not init rewritten commits" + die "$(gettext "Could not init rewritten commits")" done else mkdir "$rewritten" && echo $onto > "$rewritten"/root || - die "Could not init rewritten commits" + die "$(gettext "Could not init rewritten commits")" fi # No cherry-pick because our first pass is to determine # parents to rewrite and skipping dropped commits would @@ -1270,7 +1281,7 @@ EOF if test -z "$keep_empty" then - printf '%s\n' "$comment_char Note that empty commits are commented out" >>"$todo" + printf '%s\n' "$comment_char $(gettext "Note that empty commits are commented out")" >>"$todo" fi @@ -1280,7 +1291,7 @@ has_action "$todo" || cp "$todo" "$todo".backup collapse_todo_ids git_sequence_editor "$todo" || - die_abort "Could not execute editor" + die_abort "$(gettext "Could not execute editor")" has_action "$todo" || return 2 -- cgit v1.2.1 From b8fc9e43a7da5c8cb1e90eb569b5e821883c2e06 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Fri, 17 Jun 2016 20:21:04 +0000 Subject: i18n: rebase-interactive: mark here-doc strings for translation Use pipe to send gettext output to git stripspace instead of the original method of using shell here-document, because command substitution '$(...)' would not take place inside the here-documents. The exception is the case of the last here-document redirecting to cat, in which commands substitution works and, thus, is preserved in this commit. t3404: adapt test to the strings newly marked for translation Test t3404-rebase-interactive.sh would fail under GETTEXT_POISON unless using test_i18ngrep. Add eval_ngettext fallback functions to be called when running, for instance, under GETTEXT_POISON. Otherwise, tests would fail under GETTEXT_POISON, or other build that doesn't support the GNU gettext, because that function could not be found. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 078ca5b2d5..e132f07060 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -144,29 +144,28 @@ reschedule_last_action () { } append_todo_help () { - git stripspace --comment-lines >>"$todo" <<\EOF - + gettext " Commands: p, pick = use commit r, reword = use commit, but edit the commit message e, edit = use commit, but stop for amending s, squash = use commit, but meld into previous commit - f, fixup = like "squash", but discard this commit's log message + f, fixup = like \"squash\", but discard this commit's log message x, exec = run command (the rest of the line) using shell d, drop = remove commit These lines can be re-ordered; they are executed from top to bottom. +" | git stripspace --comment-lines >>"$todo" -EOF if test $(get_missing_commit_check_level) = error then - git stripspace --comment-lines >>"$todo" <<\EOF + gettext " Do not remove any line. Use 'drop' explicitly to remove a commit. -EOF +" | git stripspace --comment-lines >>"$todo" else - git stripspace --comment-lines >>"$todo" <<\EOF + gettext " If you remove a line here THAT COMMIT WILL BE LOST. -EOF +" | git stripspace --comment-lines >>"$todo" fi } @@ -1123,13 +1122,12 @@ edit-todo) mv -f "$todo".new "$todo" collapse_todo_ids append_todo_help - git stripspace --comment-lines >>"$todo" <<\EOF - + gettext " You are editing the todo file of an ongoing interactive rebase. To continue rebase after editing, run: git rebase --continue -EOF +" | git stripspace --comment-lines >>"$todo" git_sequence_editor "$todo" || die "$(gettext "Could not execute editor")" @@ -1270,14 +1268,16 @@ todocount=${todocount##* } cat >>"$todo" <>"$todo" <<\EOF - +gettext " However, if you remove everything, the rebase will be aborted. -EOF +" | git stripspace --comment-lines >>"$todo" if test -z "$keep_empty" then -- cgit v1.2.1 From f2d17068fd795f980811a3979d671f7d005d3f5c Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Fri, 17 Jun 2016 20:21:05 +0000 Subject: i18n: rebase-interactive: mark comments of squash for translation Mark comment messages of squash/fixup file ($squash_msg) for translation. Helper functions this_nth_commit_message and skip_nth_commit_message replace the previous method of making the comment messages (such as "This is the 2nd commit message:") aided by nth_string helper function. This step was taken as a workaround to enabled translation of entire sentences. However, doesn't change any text seen in English by the user, except for string "The first commit's message is:" which was changed to match the style of other instances. The test t3404-rebase-interactive.sh resorts to set_fake_editor which didn't account for GETTEXT_POISON. Fix it by assuming success when we find dummy gettext poison output where was supposed to find the first comment line "This is a combination of $count commits.". For that same message, use plural aware eval_ngettext instead of eval_gettext, since other languages have more complex plural forms. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano --- git-rebase--interactive.sh | 69 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-) (limited to 'git-rebase--interactive.sh') diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index e132f07060..a545d92c26 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -402,12 +402,52 @@ pick_one_preserving_merges () { esac } -nth_string () { - case "$1" in - *1[0-9]|*[04-9]) echo "$1"th;; - *1) echo "$1"st;; - *2) echo "$1"nd;; - *3) echo "$1"rd;; +this_nth_commit_message () { + n=$1 + case "$n" in + 1) gettext "This is the 1st commit message:";; + 2) gettext "This is the 2nd commit message:";; + 3) gettext "This is the 3rd commit message:";; + 4) gettext "This is the 4th commit message:";; + 5) gettext "This is the 5th commit message:";; + 6) gettext "This is the 6th commit message:";; + 7) gettext "This is the 7th commit message:";; + 8) gettext "This is the 8th commit message:";; + 9) gettext "This is the 9th commit message:";; + 10) gettext "This is the 10th commit message:";; + # TRANSLATORS: if the language you are translating into + # doesn't allow you to compose a sentence in this fashion, + # consider translating as if this and the following few strings + # were "This is the commit message ${n}:" + *1[0-9]|*[04-9]) eval_gettext "This is the \${n}th commit message:";; + *1) eval_gettext "This is the \${n}st commit message:";; + *2) eval_gettext "This is the \${n}nd commit message:";; + *3) eval_gettext "This is the \${n}rd commit message:";; + *) eval_gettext "This is the commit message \${n}:";; + esac +} +skip_nth_commit_message () { + n=$1 + case "$n" in + 1) gettext "The 1st commit message will be skipped:";; + 2) gettext "The 2nd commit message will be skipped:";; + 3) gettext "The 3rd commit message will be skipped:";; + 4) gettext "The 4th commit message will be skipped:";; + 5) gettext "The 5th commit message will be skipped:";; + 6) gettext "The 6th commit message will be skipped:";; + 7) gettext "The 7th commit message will be skipped:";; + 8) gettext "The 8th commit message will be skipped:";; + 9) gettext "The 9th commit message will be skipped:";; + 10) gettext "The 10th commit message will be skipped:";; + # TRANSLATORS: if the language you are translating into + # doesn't allow you to compose a sentence in this fashion, + # consider translating as if this and the following few strings + # were "The commit message ${n} will be skipped:" + *1[0-9]|*[04-9]) eval_gettext "The \${n}th commit message will be skipped:";; + *1) eval_gettext "The \${n}st commit message will be skipped:";; + *2) eval_gettext "The \${n}nd commit message will be skipped:";; + *3) eval_gettext "The \${n}rd commit message will be skipped:";; + *) eval_gettext "The commit message \${n} will be skipped:";; esac } @@ -415,20 +455,23 @@ update_squash_messages () { if test -f "$squash_msg"; then mv "$squash_msg" "$squash_msg".bak || exit count=$(($(sed -n \ - -e "1s/^. This is a combination of \(.*\) commits\./\1/p" \ + -e "1s/^$comment_char.*\([0-9][0-9]*\).*/\1/p" \ -e "q" < "$squash_msg".bak)+1)) { - printf '%s\n' "$comment_char This is a combination of $count commits." + printf '%s\n' "$comment_char $(eval_ngettext \ + "This is a combination of \$count commit." \ + "This is a combination of \$count commits." \ + $count)" sed -e 1d -e '2,/^./{ /^$/d }' <"$squash_msg".bak } >"$squash_msg" else - commit_message HEAD > "$fixup_msg" || die "Cannot write $fixup_msg" + commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")" count=2 { - printf '%s\n' "$comment_char This is a combination of 2 commits." - printf '%s\n' "$comment_char The first commit's message is:" + printf '%s\n' "$comment_char $(gettext "This is a combination of 2 commits.")" + printf '%s\n' "$comment_char $(gettext "This is the 1st commit message:")" echo cat "$fixup_msg" } >"$squash_msg" @@ -437,13 +480,13 @@ update_squash_messages () { squash) rm -f "$fixup_msg" echo - printf '%s\n' "$comment_char This is the $(nth_string $count) commit message:" + printf '%s\n' "$comment_char $(this_nth_commit_message $count)" echo commit_message $2 ;; fixup) echo - printf '%s\n' "$comment_char The $(nth_string $count) commit message will be skipped:" + printf '%s\n' "$comment_char $(skip_nth_commit_message $count)" echo # Change the space after the comment character to TAB: commit_message $2 | git stripspace --comment-lines | sed -e 's/ / /' -- cgit v1.2.1