[PATCH v5 2/7] i18n: rebase: mark messages for translation

2012-07-25 Thread Jiang Xin
Mark messages in git-rebase.sh for translation.  While doing this
Jonathan noticed that the comma usage and sentence structure of the
resolvemsg was not quite right, so correct that and its cousins in
git-am.sh and t/t0201-gettext-fallbacks.sh at the same time.

Some tests would start to fail with GETTEXT_POISON turned on after
this update.  Use test_i18ncmp and test_i18ngrep where appropriate
to mark strings that should only be checked in the C locale output
to avoid such issues.

Signed-off-by: Jiang Xin 
Reviewed-by: Stefano Lattarini 
---
 git-am.sh|  6 ++---
 git-rebase.sh| 64 +++-
 t/t0201-gettext-fallbacks.sh |  8 +++---
 t/t3400-rebase.sh|  8 +++---
 t/t3406-rebase-message.sh|  9 ++-
 5 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index c02e6..8961a 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -102,9 +102,9 @@ stop_here_user_resolve () {
printf '%s\n' "$resolvemsg"
stop_here $1
 fi
-eval_gettextln "When you have resolved this problem run \"\$cmdline 
--resolved\".
-If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
-To restore the original branch and stop patching run \"\$cmdline --abort\"."
+eval_gettextln "When you have resolved this problem, run \"\$cmdline 
--resolved\".
+If you prefer to skip this patch, run \"\$cmdline --skip\" instead.
+To restore the original branch and stop patching, run \"\$cmdline --abort\"."
 
 stop_here $1
 }
diff --git a/git-rebase.sh b/git-rebase.sh
index 1cd06..8710d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -65,6 +65,7 @@ abort! abort and check out the original branch
 skip!  skip current patch and continue
 "
 . git-sh-setup
+. git-sh-i18n
 set_reflog_action rebase
 require_work_tree_exists
 cd_to_toplevel
@@ -73,9 +74,9 @@ LF='
 '
 ok_to_skip_pre_rebase=
 resolvemsg="
-When you have resolved this problem run \"git rebase --continue\".
-If you would prefer to skip this patch, instead run \"git rebase --skip\".
-To check out the original branch and stop rebasing run \"git rebase --abort\".
+$(gettext 'When you have resolved this problem, run "git rebase --continue".
+If you prefer to skip this patch, run "git rebase --skip" instead.
+To check out the original branch and stop rebasing, run "git rebase --abort".')
 "
 unset onto
 cmd=
@@ -161,7 +162,7 @@ move_to_original_branch () {
git symbolic-ref \
-m "rebase finished: returning to $head_name" \
HEAD $head_name ||
-   die "Could not move back to $head_name"
+   die "$(gettext "Could not move back to $head_name")"
;;
esac
 }
@@ -180,12 +181,12 @@ run_pre_rebase_hook () {
   test -x "$GIT_DIR/hooks/pre-rebase"
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
-   die "The pre-rebase hook refused to rebase."
+   die "$(gettext "The pre-rebase hook refused to rebase.")"
fi
 }
 
 test -f "$apply_dir"/applying &&
-   die 'It looks like git-am is in progress. Cannot rebase.'
+   die "$(gettext "It looks like git-am is in progress. Cannot rebase.")"
 
 if test -d "$apply_dir"
 then
@@ -316,12 +317,12 @@ test $# -gt 2 && usage
 if test -n "$cmd" &&
test "$interactive_rebase" != explicit
 then
-   die "--exec option must be used with --interactive option"
+   die "$(gettext -- "--exec option must be used with --interactive 
option")"
 fi
 
 if test -n "$action"
 then
-   test -z "$in_progress" && die "No rebase in progress?"
+   test -z "$in_progress" && die "$(gettext "No rebase in progress?")"
# Only interactive rebase uses detailed reflog messages
if test "$type" = interactive && test "$GIT_REFLOG_ACTION" = rebase
then
@@ -334,11 +335,11 @@ case "$action" in
 continue)
# Sanity check
git rev-parse --verify HEAD >/dev/null ||
-   die "Cannot read HEAD"
+   die "$(gettext "Cannot read HEAD")"
git update-index --ignore-submodules --refresh &&
git diff-files --quiet --ignore-submodules || {
-   echo "You must edit all merge conflicts and then"
-   echo "mark them as resolved using git add"
+   echo "$(gettext "You must edit all merge conflicts and then
+mark them as resolved using git add")"
exit 1
}
read_basic_state
@@ -355,7 +356,7 @@ abort)
case "$head_name" in
refs/*)
git symbolic-ref -m "rebase: aborting" HEAD $head_name ||
-   die "Could not move back to $head_name"
+   die "$(eval_gettext "Could not move back to \$head_name")"
;;
esac
output git reset --hard $orig_head
@@ -367,15 +368,18 @@ esac
 # Make sure no rebase is in progress
 if test -n "$in_progress"
 then
-

[PATCH v5 2/7] i18n: rebase: mark messages for translation

2012-07-25 Thread Jiang Xin
Mark messages in git-rebase.sh for translation.  While doing this
Jonathan noticed that the comma usage and sentence structure of the
resolvemsg was not quite right, so correct that and its cousins in
git-am.sh and t/t0201-gettext-fallbacks.sh at the same time.

Some tests would start to fail with GETTEXT_POISON turned on after
this update.  Use test_i18ncmp and test_i18ngrep where appropriate
to mark strings that should only be checked in the C locale output
to avoid such issues.

Signed-off-by: Jiang Xin 
Reviewed-by: Stefano Lattarini 
Acked-by: Jonathan Nieder 
---
 git-am.sh|  6 ++---
 git-rebase.sh| 64 +++-
 t/t0201-gettext-fallbacks.sh |  8 +++---
 t/t3400-rebase.sh|  8 +++---
 t/t3406-rebase-message.sh|  9 ++-
 5 files changed, 53 insertions(+), 42 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index c02e6..8961a 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -102,9 +102,9 @@ stop_here_user_resolve () {
printf '%s\n' "$resolvemsg"
stop_here $1
 fi
-eval_gettextln "When you have resolved this problem run \"\$cmdline 
--resolved\".
-If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
-To restore the original branch and stop patching run \"\$cmdline --abort\"."
+eval_gettextln "When you have resolved this problem, run \"\$cmdline 
--resolved\".
+If you prefer to skip this patch, run \"\$cmdline --skip\" instead.
+To restore the original branch and stop patching, run \"\$cmdline --abort\"."
 
 stop_here $1
 }
diff --git a/git-rebase.sh b/git-rebase.sh
index 1cd06..8710d 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -65,6 +65,7 @@ abort! abort and check out the original branch
 skip!  skip current patch and continue
 "
 . git-sh-setup
+. git-sh-i18n
 set_reflog_action rebase
 require_work_tree_exists
 cd_to_toplevel
@@ -73,9 +74,9 @@ LF='
 '
 ok_to_skip_pre_rebase=
 resolvemsg="
-When you have resolved this problem run \"git rebase --continue\".
-If you would prefer to skip this patch, instead run \"git rebase --skip\".
-To check out the original branch and stop rebasing run \"git rebase --abort\".
+$(gettext 'When you have resolved this problem, run "git rebase --continue".
+If you prefer to skip this patch, run "git rebase --skip" instead.
+To check out the original branch and stop rebasing, run "git rebase --abort".')
 "
 unset onto
 cmd=
@@ -161,7 +162,7 @@ move_to_original_branch () {
git symbolic-ref \
-m "rebase finished: returning to $head_name" \
HEAD $head_name ||
-   die "Could not move back to $head_name"
+   die "$(gettext "Could not move back to $head_name")"
;;
esac
 }
@@ -180,12 +181,12 @@ run_pre_rebase_hook () {
   test -x "$GIT_DIR/hooks/pre-rebase"
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
-   die "The pre-rebase hook refused to rebase."
+   die "$(gettext "The pre-rebase hook refused to rebase.")"
fi
 }
 
 test -f "$apply_dir"/applying &&
-   die 'It looks like git-am is in progress. Cannot rebase.'
+   die "$(gettext "It looks like git-am is in progress. Cannot rebase.")"
 
 if test -d "$apply_dir"
 then
@@ -316,12 +317,12 @@ test $# -gt 2 && usage
 if test -n "$cmd" &&
test "$interactive_rebase" != explicit
 then
-   die "--exec option must be used with --interactive option"
+   die "$(gettext -- "--exec option must be used with --interactive 
option")"
 fi
 
 if test -n "$action"
 then
-   test -z "$in_progress" && die "No rebase in progress?"
+   test -z "$in_progress" && die "$(gettext "No rebase in progress?")"
# Only interactive rebase uses detailed reflog messages
if test "$type" = interactive && test "$GIT_REFLOG_ACTION" = rebase
then
@@ -334,11 +335,11 @@ case "$action" in
 continue)
# Sanity check
git rev-parse --verify HEAD >/dev/null ||
-   die "Cannot read HEAD"
+   die "$(gettext "Cannot read HEAD")"
git update-index --ignore-submodules --refresh &&
git diff-files --quiet --ignore-submodules || {
-   echo "You must edit all merge conflicts and then"
-   echo "mark them as resolved using git add"
+   echo "$(gettext "You must edit all merge conflicts and then
+mark them as resolved using git add")"
exit 1
}
read_basic_state
@@ -355,7 +356,7 @@ abort)
case "$head_name" in
refs/*)
git symbolic-ref -m "rebase: aborting" HEAD $head_name ||
-   die "Could not move back to $head_name"
+   die "$(eval_gettext "Could not move back to \$head_name")"
;;
esac
output git reset --hard $orig_head
@@ -367,15 +368,18 @@ esac
 # Make sure no rebase is in progress
 if tes