All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
@ 2012-07-22  1:26 Jiang Xin
  2012-07-22  1:26 ` [PATCH v2 1/7] i18n: New keywords for xgettext extraction from sh Jiang Xin
  2012-07-22 19:47 ` [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Junio C Hamano
  0 siblings, 2 replies; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Mark strings in git-am, git-rebase, and git-merge for translation.
And contain fixes for shell gettext extraction and xgettext workaround.

Jiang Xin (7):
  i18n: New keywords for xgettext extraction from sh
  i18n: rebase: mark strings for translation
  i18n: Rewrite gettext messages start with dash
  Remove obsolete LONG_USAGE which breaks xgettext
  i18n: am: mark more strings for translation
  Remove unused and bad gettext block from git-am
  i18n: merge-recursive: mark strings for translation

 Makefile                      |   3 +-
 git-am.sh                     |  14 ++--
 git-rebase.sh                 |  83 +++++++++--------------
 git-submodule.sh              |   2 +-
 merge-recursive.c             | 152 ++++++++++++++++++++++--------------------
 t/t3404-rebase-interactive.sh |   2 +-
 6 files changed, 120 insertions(+), 136 deletions(-)

-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/7] i18n: New keywords for xgettext extraction from sh
  2012-07-22  1:26 [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Jiang Xin
@ 2012-07-22  1:26 ` Jiang Xin
  2012-07-22  1:26   ` [PATCH v2 2/7] i18n: rebase: mark strings for translation Jiang Xin
  2012-07-22 19:47 ` [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Junio C Hamano
  1 sibling, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Since we have additional shell wrappers (gettextln and eval_gettextln)
for gettext, we need to take into account these wrappers when run
'make pot' to extract messages from shell scripts.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 285c66..e1692 100644
--- a/Makefile
+++ b/Makefile
@@ -2376,7 +2376,8 @@ XGETTEXT_FLAGS = \
 	--from-code=UTF-8
 XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
 	--keyword=_ --keyword=N_ --keyword="Q_:1,2"
-XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
+XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
+	--keyword=gettextln --keyword=eval_gettextln
 XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
 LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
 LOCALIZED_SH := $(SCRIPT_SH)
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 2/7] i18n: rebase: mark strings for translation
  2012-07-22  1:26 ` [PATCH v2 1/7] i18n: New keywords for xgettext extraction from sh Jiang Xin
@ 2012-07-22  1:26   ` Jiang Xin
  2012-07-22  1:26     ` [PATCH v2 3/7] i18n: Rewrite gettext messages start with dash Jiang Xin
  2012-07-22 19:04     ` [PATCH v2 2/7] i18n: rebase: " Junio C Hamano
  0 siblings, 2 replies; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
---
 git-rebase.sh | 58 ++++++++++++++++++++++++++++++----------------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 1cd06..df5998 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
@@ -72,11 +73,11 @@ cd_to_toplevel
 LF='
 '
 ok_to_skip_pre_rebase=
-resolvemsg="
+resolvemsg="$(gettext "
 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\".
-"
+")"
 unset onto
 cmd=
 strategy=
@@ -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,16 @@ esac
 # Make sure no rebase is in progress
 if test -n "$in_progress"
 then
-	die '
-It seems that there is already a '"${state_dir##*/}"' directory, and
+	state_dir_base=${state_dir##*/}
+	die "$(eval_gettext "
+It seems that there is already a \$state_dir_base directory, and
 I wonder if you are in the middle of another rebase.  If that is the
 case, please try
 	git rebase (--continue | --abort | --skip)
 If that is not the case, please
-	rm -fr '"$state_dir"'
+	rm -fr \"\$state_dir\"
 and run me again.  I am stopping in case you still have something
-valuable there.'
+valuable there.")"
 fi
 
 if test -n "$rebase_root" && test -z "$onto"
@@ -413,7 +415,7 @@ then
 		;;
 	esac
 	upstream=`git rev-parse --verify "${upstream_name}^0"` ||
-	die "invalid upstream $upstream_name"
+	die "$(eval_gettext "invalid upstream \$upstream_name")"
 	upstream_arg="$upstream_name"
 else
 	if test -z "$onto"
@@ -437,19 +439,19 @@ case "$onto_name" in
 	then
 		case "$onto" in
 		?*"$LF"?*)
-			die "$onto_name: there are more than one merge bases"
+			die "$(eval_gettext "\$onto_name: there are more than one merge bases")"
 			;;
 		'')
-			die "$onto_name: there is no merge base"
+			die "$(eval_gettext "\$onto_name: there is no merge base")"
 			;;
 		esac
 	else
-		die "$onto_name: there is no merge base"
+		die "$(eval_gettext "\$onto_name: there is no merge base")"
 	fi
 	;;
 *)
 	onto=$(git rev-parse --verify "${onto_name}^0") ||
-	die "Does not point to a valid commit: $onto_name"
+	die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"
 	;;
 esac
 
@@ -472,7 +474,7 @@ case "$#" in
 	then
 		head_name="detached HEAD"
 	else
-		die "fatal: no such branch: $1"
+		die "$(eval_gettext "fatal: no such branch: \$branch_name")"
 	fi
 	;;
 0)
@@ -488,11 +490,11 @@ case "$#" in
 	orig_head=$(git rev-parse --verify "${branch_name}^0") || exit
 	;;
 *)
-	die "BUG: unexpected number of arguments left to parse"
+	die "$(gettext "BUG: unexpected number of arguments left to parse")"
 	;;
 esac
 
-require_clean_work_tree "rebase" "Please commit or stash them."
+require_clean_work_tree "rebase" "$(gettext "Please commit or stash them.")"
 
 # Now we are rebasing commits $upstream..$orig_head (or with --root,
 # everything leading up to $orig_head) on top of $onto
@@ -510,10 +512,10 @@ then
 	then
 		# Lazily switch to the target branch if needed...
 		test -z "$switch_to" || git checkout "$switch_to" --
-		say "Current branch $branch_name is up to date."
+		say "$(eval_gettext "Current branch \$branch_name is up to date.")"
 		exit 0
 	else
-		say "Current branch $branch_name is up to date, rebase forced."
+		say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
 	fi
 fi
 
@@ -524,7 +526,7 @@ if test -n "$diffstat"
 then
 	if test -n "$verbose"
 	then
-		echo "Changes from $mb to $onto:"
+		echo "$(eval_gettext "Changes from \$mb to \$onto:")"
 	fi
 	# We want color (if set), but no pager
 	GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
@@ -533,7 +535,7 @@ fi
 test "$type" = interactive && run_specific_rebase
 
 # Detach HEAD and reset the tree
-say "First, rewinding head to replay your work on top of it..."
+say "$(gettext "First, rewinding head to replay your work on top of it...")"
 git checkout -q "$onto^0" || die "could not detach HEAD"
 git update-ref ORIG_HEAD $orig_head
 
@@ -541,7 +543,7 @@ git update-ref ORIG_HEAD $orig_head
 # we just fast-forwarded.
 if test "$mb" = "$orig_head"
 then
-	say "Fast-forwarded $branch_name to $onto_name."
+	say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
 	move_to_original_branch
 	exit 0
 fi
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 3/7] i18n: Rewrite gettext messages start with dash
  2012-07-22  1:26   ` [PATCH v2 2/7] i18n: rebase: mark strings for translation Jiang Xin
@ 2012-07-22  1:26     ` Jiang Xin
  2012-07-22  1:26       ` [PATCH v2 4/7] Remove obsolete LONG_USAGE which breaks xgettext Jiang Xin
  2012-07-22 19:04     ` [PATCH v2 2/7] i18n: rebase: " Junio C Hamano
  1 sibling, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Gettext message in a shell script should not start with '-', one
workaround is adding '--' between gettext and the message, like:

    gettext -- "--exec option ..."

But due to a bug in the xgettext extraction, xgettext can not
extract the actual message for this case. Rewriting the message
is a simpler and better solution.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 git-rebase.sh                 | 2 +-
 git-submodule.sh              | 2 +-
 t/t3404-rebase-interactive.sh | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index df5998..640af 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -317,7 +317,7 @@ test $# -gt 2 && usage
 if test -n "$cmd" &&
    test "$interactive_rebase" != explicit
 then
-	die "$(gettext -- "--exec option must be used with --interactive option")"
+	die "$(gettext "The --exec option must be used with the --interactive option")"
 fi
 
 if test -n "$action"
diff --git a/git-submodule.sh b/git-submodule.sh
index 5629d..57f98 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -746,7 +746,7 @@ cmd_summary() {
 	if [ -n "$files" ]
 	then
 		test -n "$cached" &&
-		die "$(gettext -- "--cached cannot be used with --files")"
+		die "$(gettext "The --cached option cannot be used with the --files option")"
 		diff_cmd=diff-files
 		head=
 	fi
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 8078..f206a 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -858,7 +858,7 @@ test_expect_success 'rebase -ix with --autosquash' '
 test_expect_success 'rebase --exec without -i shows error message' '
 	git reset --hard execute &&
 	test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual &&
-	echo "--exec option must be used with --interactive option" >expected &&
+	echo "The --exec option must be used with the --interactive option" >expected &&
 	test_i18ncmp expected actual
 '
 
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 4/7] Remove obsolete LONG_USAGE which breaks xgettext
  2012-07-22  1:26     ` [PATCH v2 3/7] i18n: Rewrite gettext messages start with dash Jiang Xin
@ 2012-07-22  1:26       ` Jiang Xin
  2012-07-22  1:26         ` [PATCH v2 5/7] i18n: am: mark more strings for translation Jiang Xin
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

The obsolete LONG_USAGE variable has the following message in it:

    A'\''--B'\''--C'\''

And such complex LONG_USAGE message will breaks xgettext when extracting
l10n messages. But if single quotes are removed from the message, xgettext
works fine on 'git-rebase.sh'.

Since there is a modern OPTIONS_SPEC variable in use in this script,
it's safe to remove the obsolete USAGE and LONG_USAGE variables.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 git-rebase.sh | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 640af..02c63 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,31 +3,6 @@
 # Copyright (c) 2005 Junio C Hamano.
 #
 
-USAGE='[--interactive | -i] [--exec | -x <cmd>] [-v] [--force-rebase | -f]
-       [--no-ff] [--onto <newbase>] [<upstream>|--root] [<branch>] [--quiet | -q]'
-LONG_USAGE='git-rebase replaces <branch> with a new branch of the
-same name.  When the --onto option is provided the new branch starts
-out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
-It then attempts to create a new commit for each commit from the original
-<branch> that does not exist in the <upstream> branch.
-
-It is possible that a merge failure will prevent this process from being
-completely automatic.  You will have to resolve any such merge failure
-and run git rebase --continue.  Another option is to bypass the commit
-that caused the merge failure with git rebase --skip.  To check out the
-original <branch> and remove the .git/rebase-apply working files, use the
-command git rebase --abort instead.
-
-Note that if <branch> is not specified on the command line, the
-currently checked out branch is used.
-
-Example:       git-rebase master~1 topic
-
-	A---B---C topic                   A'\''--B'\''--C'\'' topic
-       /                   -->           /
-  D---E---F---G master          D---E---F---G master
-'
-
 SUBDIRECTORY_OK=Yes
 OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC="\
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 5/7] i18n: am: mark more strings for translation
  2012-07-22  1:26       ` [PATCH v2 4/7] Remove obsolete LONG_USAGE which breaks xgettext Jiang Xin
@ 2012-07-22  1:26         ` Jiang Xin
  2012-07-22  1:26           ` [PATCH v2 6/7] Remove unused and bad gettext block from git-am Jiang Xin
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Mark additional 3 strings for translation, and reduce one indentation
level for one gettextln clause introduced in commit de88c1c.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 git-am.sh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index b6a53..20c1a 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -92,7 +92,7 @@ safe_to_abort () {
 	then
 		return 0
 	fi
-		gettextln "You seem to have moved HEAD since the last 'am' failure.
+	gettextln "You seem to have moved HEAD since the last 'am' failure.
 Not rewinding to ORIG_HEAD" >&2
 	return 1
 }
@@ -136,7 +136,7 @@ fall_back_3way () {
     git write-tree >"$dotest/patch-merge-base+" ||
     cannot_fallback "$(gettext "Repository lacks necessary blobs to fall back on 3-way merge.")"
 
-    say Using index info to reconstruct a base tree...
+    say "$(gettext "Using index info to reconstruct a base tree...")"
 
     cmd='GIT_INDEX_FILE="$dotest/patch-merge-tmp-index"'
 
@@ -176,8 +176,7 @@ It does not apply to blobs recorded in its index.")"
     fi
     git-merge-recursive $orig_tree -- HEAD $his_tree || {
 	    git rerere $allow_rerere_autoupdate
-	    echo Failed to merge in the changes.
-	    exit 1
+	    die "$(gettext "Failed to merge in the changes.")"
     }
     unset GITHEAD_$his_tree
 }
@@ -387,8 +386,8 @@ do
 	-i|--interactive)
 		interactive=t ;;
 	-b|--binary)
-		echo >&2 "The $1 option has been a no-op for long time, and"
-		echo >&2 "it will be removed. Please do not use it anymore."
+		echo >&2 $(gettext "The -b option has been a no-op for long time, and
+it will be removed. Please do not use it anymore.")
 		;;
 	-3|--3way)
 		threeway=t ;;
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 6/7] Remove unused and bad gettext block from git-am
  2012-07-22  1:26         ` [PATCH v2 5/7] i18n: am: mark more strings for translation Jiang Xin
@ 2012-07-22  1:26           ` Jiang Xin
  2012-07-22  1:26             ` [PATCH v2 7/7] i18n: merge-recursive: mark strings for translation Jiang Xin
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Gettext message should not start with '-' nor '--'. Since the '-d' and
'--dotest' options do not exist in OPTIONS_SPEC variable, it's safe to
remove the block.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
---
 git-am.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index 20c1a..cfa63 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -413,9 +413,6 @@ it will be removed. Please do not use it anymore.")
 		abort=t ;;
 	--rebasing)
 		rebasing=t threeway=t ;;
-	-d|--dotest)
-		die "$(gettext "-d option is no longer supported.  Do not use.")"
-		;;
 	--resolvemsg)
 		shift; resolvemsg=$1 ;;
 	--whitespace|--directory|--exclude|--include)
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 7/7] i18n: merge-recursive: mark strings for translation
  2012-07-22  1:26           ` [PATCH v2 6/7] Remove unused and bad gettext block from git-am Jiang Xin
@ 2012-07-22  1:26             ` Jiang Xin
  2012-07-22 19:37               ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-22  1:26 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini,
	Jiang Xin

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
---
 merge-recursive.c | 152 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 81 insertions(+), 71 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 68093..d0167 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -187,7 +187,7 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
 	else {
 		printf("%s ", find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
 		if (parse_commit(commit) != 0)
-			printf("(bad commit)\n");
+			printf(_("(bad commit)\n"));
 		else {
 			const char *title;
 			int len = find_commit_subject(commit->buffer, &title);
@@ -203,7 +203,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
 	struct cache_entry *ce;
 	ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, refresh);
 	if (!ce)
-		return error("addinfo_cache failed for path '%s'", path);
+		return error(_("addinfo_cache failed for path '%s'"), path);
 	return add_cache_entry(ce, options);
 }
 
@@ -249,14 +249,14 @@ struct tree *write_tree_from_memory(struct merge_options *o)
 
 	if (unmerged_cache()) {
 		int i;
-		fprintf(stderr, "BUG: There are unmerged index entries:\n");
+		fprintf(stderr, _("BUG: There are unmerged index entries:\n"));
 		for (i = 0; i < active_nr; i++) {
 			struct cache_entry *ce = active_cache[i];
 			if (ce_stage(ce))
 				fprintf(stderr, "BUG: %d %.*s\n", ce_stage(ce),
 					(int)ce_namelen(ce), ce->name);
 		}
-		die("Bug in merge-recursive.c");
+		die(_("Bug in merge-recursive.c"));
 	}
 
 	if (!active_cache_tree)
@@ -265,7 +265,7 @@ struct tree *write_tree_from_memory(struct merge_options *o)
 	if (!cache_tree_fully_valid(active_cache_tree) &&
 	    cache_tree_update(active_cache_tree,
 			      active_cache, active_nr, 0) < 0)
-		die("error building trees");
+		die(_("error building trees"));
 
 	result = lookup_tree(active_cache_tree->sha1);
 
@@ -494,7 +494,7 @@ static struct string_list *get_renames(struct merge_options *o,
 	opts.show_rename_progress = o->show_rename_progress;
 	opts.output_format = DIFF_FORMAT_NO_OUTPUT;
 	if (diff_setup_done(&opts) < 0)
-		die("diff setup failed");
+		die(_("diff setup failed"));
 	diff_tree_sha1(o_tree->object.sha1, tree->object.sha1, "", &opts);
 	diffcore_std(&opts);
 	if (opts.needed_rename_limit > o->needed_rename_limit)
@@ -624,7 +624,7 @@ static void flush_buffer(int fd, const char *buf, unsigned long size)
 				break;
 			die_errno("merge-recursive");
 		} else if (!ret) {
-			die("merge-recursive: disk full?");
+			die(_("merge-recursive: disk full?"));
 		}
 		size -= ret;
 		buf += ret;
@@ -687,7 +687,7 @@ static int would_lose_untracked(const char *path)
 static int make_room_for_path(struct merge_options *o, const char *path)
 {
 	int status, i;
-	const char *msg = "failed to create path '%s'%s";
+	const char *msg = _("failed to create path '%s'%s");
 
 	/* Unlink any D/F conflict files that are in the way */
 	for (i = 0; i < o->df_conflict_file_set.nr; i++) {
@@ -698,7 +698,7 @@ static int make_room_for_path(struct merge_options *o, const char *path)
 		    path[df_pathlen] == '/' &&
 		    strncmp(path, df_path, df_pathlen) == 0) {
 			output(o, 3,
-			       "Removing %s to make room for subdirectory\n",
+			       _("Removing %s to make room for subdirectory\n"),
 			       df_path);
 			unlink(df_path);
 			unsorted_string_list_delete_item(&o->df_conflict_file_set,
@@ -712,7 +712,7 @@ static int make_room_for_path(struct merge_options *o, const char *path)
 	if (status) {
 		if (status == -3) {
 			/* something else exists */
-			error(msg, path, ": perhaps a D/F conflict?");
+			error(msg, path, _(": perhaps a D/F conflict?"));
 			return -1;
 		}
 		die(msg, path, "");
@@ -723,7 +723,7 @@ static int make_room_for_path(struct merge_options *o, const char *path)
 	 * tracking it.
 	 */
 	if (would_lose_untracked(path))
-		return error("refusing to lose untracked file at '%s'",
+		return error(_("refusing to lose untracked file at '%s'"),
 			     path);
 
 	/* Successful unlink is good.. */
@@ -733,7 +733,7 @@ static int make_room_for_path(struct merge_options *o, const char *path)
 	if (errno == ENOENT)
 		return 0;
 	/* .. but not some other error (who really cares what?) */
-	return error(msg, path, ": perhaps a D/F conflict?");
+	return error(msg, path, _(": perhaps a D/F conflict?"));
 }
 
 static void update_file_flags(struct merge_options *o,
@@ -763,9 +763,9 @@ static void update_file_flags(struct merge_options *o,
 
 		buf = read_sha1_file(sha, &type, &size);
 		if (!buf)
-			die("cannot read object %s '%s'", sha1_to_hex(sha), path);
+			die(_("cannot read object %s '%s'"), sha1_to_hex(sha), path);
 		if (type != OBJ_BLOB)
-			die("blob expected for %s '%s'", sha1_to_hex(sha), path);
+			die(_("blob expected for %s '%s'"), sha1_to_hex(sha), path);
 		if (S_ISREG(mode)) {
 			struct strbuf strbuf = STRBUF_INIT;
 			if (convert_to_working_tree(path, buf, size, &strbuf)) {
@@ -788,7 +788,7 @@ static void update_file_flags(struct merge_options *o,
 				mode = 0666;
 			fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
 			if (fd < 0)
-				die_errno("failed to open '%s'", path);
+				die_errno(_("failed to open '%s'"), path);
 			flush_buffer(fd, buf, size);
 			close(fd);
 		} else if (S_ISLNK(mode)) {
@@ -796,10 +796,10 @@ static void update_file_flags(struct merge_options *o,
 			safe_create_leading_directories_const(path);
 			unlink(path);
 			if (symlink(lnk, path))
-				die_errno("failed to symlink '%s'", path);
+				die_errno(_("failed to symlink '%s'"), path);
 			free(lnk);
 		} else
-			die("do not know what to do with %06o %s '%s'",
+			die(_("do not know what to do with %06o %s '%s'"),
 			    mode, sha1_to_hex(sha), path);
 		free(buf);
 	}
@@ -936,11 +936,11 @@ static struct merge_file_info merge_file_1(struct merge_options *o,
 						  branch1, branch2);
 
 			if ((merge_status < 0) || !result_buf.ptr)
-				die("Failed to execute internal merge");
+				die(_("Failed to execute internal merge"));
 
 			if (write_sha1_file(result_buf.ptr, result_buf.size,
 					    blob_type, result.sha))
-				die("Unable to add %s to database",
+				die(_("Unable to add %s to database"),
 				    a->path);
 
 			free(result_buf.ptr);
@@ -956,7 +956,7 @@ static struct merge_file_info merge_file_1(struct merge_options *o,
 			if (!sha_eq(a->sha1, b->sha1))
 				result.clean = 0;
 		} else {
-			die("unsupported object type in the tree");
+			die(_("unsupported object type in the tree"));
 		}
 	}
 
@@ -1034,22 +1034,32 @@ static void handle_change_delete(struct merge_options *o,
 		remove_file_from_cache(path);
 		update_file(o, 0, o_sha, o_mode, renamed ? renamed : path);
 	} else if (!a_sha) {
-		output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
-		       "and %s in %s. Version %s of %s left in tree%s%s.",
-		       change, path, o->branch1,
-		       change_past, o->branch2, o->branch2, path,
-		       NULL == renamed ? "" : " at ",
-		       NULL == renamed ? "" : renamed);
-		update_file(o, 0, b_sha, b_mode, renamed ? renamed : path);
+		if (NULL == renamed) {
+			output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "
+			       "and %s in %s. Version %s of %s left in tree."),
+			       change, path, o->branch1, change_past,
+			       o->branch2, o->branch2, path);
+			update_file(o, 0, b_sha, b_mode, path);
+		} else {
+			output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "
+			       "and %s in %s. Version %s of %s left in tree at %s."),
+			       change, path, o->branch1, change_past,
+			       o->branch2, o->branch2, path, renamed);
+			update_file(o, 0, b_sha, b_mode, renamed);
+		}
 	} else {
-		output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
-		       "and %s in %s. Version %s of %s left in tree%s%s.",
-		       change, path, o->branch2,
-		       change_past, o->branch1, o->branch1, path,
-		       NULL == renamed ? "" : " at ",
-		       NULL == renamed ? "" : renamed);
-		if (renamed)
+		if (NULL == renamed) {
+			output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "
+			       "and %s in %s. Version %s of %s left in tree."),
+			       change, path, o->branch2, change_past,
+			       o->branch1, o->branch1, path);
+		} else {
+			output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "
+			       "and %s in %s. Version %s of %s left in tree at %s."),
+			       change, path, o->branch2, change_past,
+			       o->branch1, o->branch1, path, renamed);
 			update_file(o, 0, a_sha, a_mode, renamed);
+		}
 		/*
 		 * No need to call update_file() on path when !renamed, since
 		 * that would needlessly touch path.  We could call
@@ -1085,7 +1095,7 @@ static void conflict_rename_delete(struct merge_options *o,
 			     orig->sha1, orig->mode,
 			     a_sha, a_mode,
 			     b_sha, b_mode,
-			     "rename", "renamed");
+			     _("rename"), _("renamed"));
 
 	if (o->call_depth) {
 		remove_file_from_cache(dest->path);
@@ -1141,7 +1151,7 @@ static void handle_file(struct merge_options *o,
 	} else {
 		if (dir_in_way(rename->path, !o->call_depth)) {
 			dst_name = unique_path(o, rename->path, cur_branch);
-			output(o, 1, "%s is a directory in %s adding as %s instead",
+			output(o, 1, _("%s is a directory in %s adding as %s instead"),
 			       rename->path, other_branch, dst_name);
 		}
 	}
@@ -1163,12 +1173,12 @@ static void conflict_rename_rename_1to2(struct merge_options *o,
 	struct diff_filespec *a = ci->pair1->two;
 	struct diff_filespec *b = ci->pair2->two;
 
-	output(o, 1, "CONFLICT (rename/rename): "
+	output(o, 1, _("CONFLICT (rename/rename): "
 	       "Rename \"%s\"->\"%s\" in branch \"%s\" "
-	       "rename \"%s\"->\"%s\" in \"%s\"%s",
+	       "rename \"%s\"->\"%s\" in \"%s\"%s"),
 	       one->path, a->path, ci->branch1,
 	       one->path, b->path, ci->branch2,
-	       o->call_depth ? " (left unresolved)" : "");
+	       o->call_depth ? _(" (left unresolved)") : "");
 	if (o->call_depth) {
 		struct merge_file_info mfi;
 		struct diff_filespec other;
@@ -1222,9 +1232,9 @@ static void conflict_rename_rename_2to1(struct merge_options *o,
 	struct merge_file_info mfi_c1;
 	struct merge_file_info mfi_c2;
 
-	output(o, 1, "CONFLICT (rename/rename): "
+	output(o, 1, _("CONFLICT (rename/rename): "
 	       "Rename %s->%s in %s. "
-	       "Rename %s->%s in %s",
+	       "Rename %s->%s in %s"),
 	       a->path, c1->path, ci->branch1,
 	       b->path, c2->path, ci->branch2);
 
@@ -1252,7 +1262,7 @@ static void conflict_rename_rename_2to1(struct merge_options *o,
 	} else {
 		char *new_path1 = unique_path(o, path, ci->branch1);
 		char *new_path2 = unique_path(o, path, ci->branch2);
-		output(o, 1, "Renaming %s to %s and %s to %s instead",
+		output(o, 1, _("Renaming %s to %s and %s to %s instead"),
 		       a->path, new_path1, b->path, new_path2);
 		remove_file(o, 0, path, 0);
 		update_file(o, 0, mfi_c1.sha, mfi_c1.mode, new_path1);
@@ -1451,8 +1461,8 @@ static int process_renames(struct merge_options *o,
 			} else if (!sha_eq(dst_other.sha1, null_sha1)) {
 				clean_merge = 0;
 				try_merge = 1;
-				output(o, 1, "CONFLICT (rename/add): Rename %s->%s in %s. "
-				       "%s added in %s",
+				output(o, 1, _("CONFLICT (rename/add): Rename %s->%s in %s. "
+				       "%s added in %s"),
 				       ren1_src, ren1_dst, branch1,
 				       ren1_dst, branch2);
 				if (o->call_depth) {
@@ -1461,12 +1471,12 @@ static int process_renames(struct merge_options *o,
 							 ren1->pair->two->sha1, ren1->pair->two->mode,
 							 dst_other.sha1, dst_other.mode,
 							 branch1, branch2);
-					output(o, 1, "Adding merged %s", ren1_dst);
+					output(o, 1, _("Adding merged %s"), ren1_dst);
 					update_file(o, 0, mfi.sha, mfi.mode, ren1_dst);
 					try_merge = 0;
 				} else {
 					char *new_path = unique_path(o, ren1_dst, branch2);
-					output(o, 1, "Adding as %s instead", new_path);
+					output(o, 1, _("Adding as %s instead"), new_path);
 					update_file(o, 0, dst_other.sha1, dst_other.mode, new_path);
 					free(new_path);
 				}
@@ -1517,10 +1527,10 @@ static int read_sha1_strbuf(const unsigned char *sha1, struct strbuf *dst)
 	unsigned long size;
 	buf = read_sha1_file(sha1, &type, &size);
 	if (!buf)
-		return error("cannot read object %s", sha1_to_hex(sha1));
+		return error(_("cannot read object %s"), sha1_to_hex(sha1));
 	if (type != OBJ_BLOB) {
 		free(buf);
-		return error("object %s is not a blob", sha1_to_hex(sha1));
+		return error(_("object %s is not a blob"), sha1_to_hex(sha1));
 	}
 	strbuf_attach(dst, buf, size, size + 1);
 	return 0;
@@ -1568,7 +1578,7 @@ static void handle_modify_delete(struct merge_options *o,
 			     o_sha, o_mode,
 			     a_sha, a_mode,
 			     b_sha, b_mode,
-			     "modify", "modified");
+			     _("modify"), _("modified"));
 }
 
 static int merge_content(struct merge_options *o,
@@ -1578,14 +1588,14 @@ static int merge_content(struct merge_options *o,
 			 unsigned char *b_sha, int b_mode,
 			 struct rename_conflict_info *rename_conflict_info)
 {
-	const char *reason = "content";
+	const char *reason = _("content");
 	const char *path1 = NULL, *path2 = NULL;
 	struct merge_file_info mfi;
 	struct diff_filespec one, a, b;
 	unsigned df_conflict_remains = 0;
 
 	if (!o_sha) {
-		reason = "add/add";
+		reason = _("add/add");
 		o_sha = (unsigned char *)null_sha1;
 	}
 	one.path = a.path = b.path = (char *)path;
@@ -1619,7 +1629,7 @@ static int merge_content(struct merge_options *o,
 	if (mfi.clean && !df_conflict_remains &&
 	    sha_eq(mfi.sha, a_sha) && mfi.mode == a_mode) {
 		int path_renamed_outside_HEAD;
-		output(o, 3, "Skipped %s (merged same as existing)", path);
+		output(o, 3, _("Skipped %s (merged same as existing)"), path);
 		/*
 		 * The content merge resulted in the same file contents we
 		 * already had.  We can return early if those file contents
@@ -1633,12 +1643,12 @@ static int merge_content(struct merge_options *o,
 			return mfi.clean;
 		}
 	} else
-		output(o, 2, "Auto-merging %s", path);
+		output(o, 2, _("Auto-merging %s"), path);
 
 	if (!mfi.clean) {
 		if (S_ISGITLINK(mfi.mode))
-			reason = "submodule";
-		output(o, 1, "CONFLICT (%s): Merge conflict in %s",
+			reason = _("submodule");
+		output(o, 1, _("CONFLICT (%s): Merge conflict in %s"),
 				reason, path);
 		if (rename_conflict_info && !df_conflict_remains)
 			update_stages(path, &one, &a, &b);
@@ -1664,7 +1674,7 @@ static int merge_content(struct merge_options *o,
 
 		}
 		new_path = unique_path(o, path, rename_conflict_info->branch1);
-		output(o, 1, "Adding as %s instead", new_path);
+		output(o, 1, _("Adding as %s instead"), new_path);
 		update_file(o, 0, mfi.sha, mfi.mode, new_path);
 		free(new_path);
 		mfi.clean = 0;
@@ -1728,7 +1738,7 @@ static int process_entry(struct merge_options *o,
 			/* Deleted in both or deleted in one and
 			 * unchanged in the other */
 			if (a_sha)
-				output(o, 2, "Removing %s", path);
+				output(o, 2, _("Removing %s"), path);
 			/* do not touch working file if it did not exist */
 			remove_file(o, 1, path, !a_sha);
 		} else {
@@ -1753,19 +1763,19 @@ static int process_entry(struct merge_options *o,
 			other_branch = o->branch2;
 			mode = a_mode;
 			sha = a_sha;
-			conf = "file/directory";
+			conf = _("file/directory");
 		} else {
 			add_branch = o->branch2;
 			other_branch = o->branch1;
 			mode = b_mode;
 			sha = b_sha;
-			conf = "directory/file";
+			conf = _("directory/file");
 		}
 		if (dir_in_way(path, !o->call_depth)) {
 			char *new_path = unique_path(o, path, add_branch);
 			clean_merge = 0;
-			output(o, 1, "CONFLICT (%s): There is a directory with name %s in %s. "
-			       "Adding %s as %s",
+			output(o, 1, _("CONFLICT (%s): There is a directory with name %s in %s. "
+			       "Adding %s as %s"),
 			       conf, path, other_branch, path, new_path);
 			if (o->call_depth)
 				remove_file_from_cache(path);
@@ -1774,7 +1784,7 @@ static int process_entry(struct merge_options *o,
 				remove_file_from_cache(path);
 			free(new_path);
 		} else {
-			output(o, 2, "Adding %s", path);
+			output(o, 2, _("Adding %s"), path);
 			/* do not overwrite file if already present */
 			update_file_flags(o, sha, mode, path, 1, !a_sha);
 		}
@@ -1791,7 +1801,7 @@ static int process_entry(struct merge_options *o,
 		 */
 		remove_file(o, 1, path, !a_mode);
 	} else
-		die("Fatal merge failure, shouldn't happen.");
+		die(_("Fatal merge failure, shouldn't happen."));
 
 	return clean_merge;
 }
@@ -1810,7 +1820,7 @@ int merge_trees(struct merge_options *o,
 	}
 
 	if (sha_eq(common->object.sha1, merge->object.sha1)) {
-		output(o, 0, "Already up-to-date!");
+		output(o, 0, _("Already up-to-date!"));
 		*result = head;
 		return 1;
 	}
@@ -1819,7 +1829,7 @@ int merge_trees(struct merge_options *o,
 
 	if (code != 0) {
 		if (show(o, 4) || o->call_depth)
-			die("merging of trees %s and %s failed",
+			die(_("merging of trees %s and %s failed"),
 			    sha1_to_hex(head->object.sha1),
 			    sha1_to_hex(merge->object.sha1));
 		else
@@ -1849,7 +1859,7 @@ int merge_trees(struct merge_options *o,
 		for (i = 0; i < entries->nr; i++) {
 			struct stage_data *e = entries->items[i].util;
 			if (!e->processed)
-				die("Unprocessed path??? %s",
+				die(_("Unprocessed path??? %s"),
 				    entries->items[i].string);
 		}
 
@@ -1894,7 +1904,7 @@ int merge_recursive(struct merge_options *o,
 	int clean;
 
 	if (show(o, 4)) {
-		output(o, 4, "Merging:");
+		output(o, 4, _("Merging:"));
 		output_commit_title(o, h1);
 		output_commit_title(o, h2);
 	}
@@ -1905,7 +1915,7 @@ int merge_recursive(struct merge_options *o,
 	}
 
 	if (show(o, 5)) {
-		output(o, 5, "found %u common ancestor(s):", commit_list_count(ca));
+		output(o, 5, _("found %u common ancestor(s):"), commit_list_count(ca));
 		for (iter = ca; iter; iter = iter->next)
 			output_commit_title(o, iter->item);
 	}
@@ -1941,7 +1951,7 @@ int merge_recursive(struct merge_options *o,
 		o->call_depth--;
 
 		if (!merged_common_ancestors)
-			die("merge returned no commit");
+			die(_("merge returned no commit"));
 	}
 
 	discard_cache();
@@ -1998,7 +2008,7 @@ int merge_recursive_generic(struct merge_options *o,
 		for (i = 0; i < num_base_list; ++i) {
 			struct commit *base;
 			if (!(base = get_ref(base_list[i], sha1_to_hex(base_list[i]))))
-				return error("Could not parse object '%s'",
+				return error(_("Could not parse object '%s'"),
 					sha1_to_hex(base_list[i]));
 			commit_list_insert(base, &ca);
 		}
@@ -2010,7 +2020,7 @@ int merge_recursive_generic(struct merge_options *o,
 	if (active_cache_changed &&
 			(write_cache(index_fd, active_cache, active_nr) ||
 			 commit_locked_index(lock)))
-		return error("Unable to write index.");
+		return error(_("Unable to write index."));
 
 	return clean ? 0 : 1;
 }
-- 
1.7.11.2.259.g37fc0e1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/7] i18n: rebase: mark strings for translation
  2012-07-22  1:26   ` [PATCH v2 2/7] i18n: rebase: mark strings for translation Jiang Xin
  2012-07-22  1:26     ` [PATCH v2 3/7] i18n: Rewrite gettext messages start with dash Jiang Xin
@ 2012-07-22 19:04     ` Junio C Hamano
  1 sibling, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2012-07-22 19:04 UTC (permalink / raw)
  To: Jiang Xin
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini

Jiang Xin <worldhello.net@gmail.com> writes:

> -resolvemsg="
> +resolvemsg="$(gettext "
>  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\".
> -"
> +")"

Two micronits:

 - A="B" assignment can lose the outermost dq-pair around it
   (i.e. A=B), which might make the above easier to read.

 - The original message had to backslash-quote only because the
   outermost quote was done with a dq-pair, but it does not use any
   substitutions, so turning it into a sq-pair might make the above
   easier to read.

With "might", I am not saying the above should be _fixed_; I am
merely saying we may want to consider these points to see if some
changes to your patch are improvements.

    resolvemsg=$(gettext '
    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".
    ')

> @@ -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")"

This is a related tangent, but have we resolved that issue with
xgettext and "--"?

Ahh, I see you did something in [3/7] ;-)

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 7/7] i18n: merge-recursive: mark strings for translation
  2012-07-22  1:26             ` [PATCH v2 7/7] i18n: merge-recursive: mark strings for translation Jiang Xin
@ 2012-07-22 19:37               ` Junio C Hamano
  0 siblings, 0 replies; 16+ messages in thread
From: Junio C Hamano @ 2012-07-22 19:37 UTC (permalink / raw)
  To: Jiang Xin
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini

Jiang Xin <worldhello.net@gmail.com> writes:

> @@ -249,14 +249,14 @@ struct tree *write_tree_from_memory(struct merge_options *o)
>  
>  	if (unmerged_cache()) {
>  		int i;
> -		fprintf(stderr, "BUG: There are unmerged index entries:\n");
> +		fprintf(stderr, _("BUG: There are unmerged index entries:\n"));

Micronit. "BUG:" entries are only to help Git developers to locate
the exact codepath that is buggy, and I think it is better left
untranslated.

> +		if (NULL == renamed) {

Better written as "if (!renamed)".

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-22  1:26 [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Jiang Xin
  2012-07-22  1:26 ` [PATCH v2 1/7] i18n: New keywords for xgettext extraction from sh Jiang Xin
@ 2012-07-22 19:47 ` Junio C Hamano
  2012-07-23  3:14   ` Jiang Xin
  1 sibling, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2012-07-22 19:47 UTC (permalink / raw)
  To: Jiang Xin
  Cc: Git List, Ævar Arnfjörð Bjarmason,
	Nguyễn Thái Ngọc Duy, Stefano Lattarini

Jiang Xin <worldhello.net@gmail.com> writes:

> Mark strings in git-am, git-rebase, and git-merge for translation.
> And contain fixes for shell gettext extraction and xgettext workaround.
>
> Jiang Xin (7):
>   i18n: New keywords for xgettext extraction from sh
>   i18n: rebase: mark strings for translation
>   i18n: Rewrite gettext messages start with dash
>   Remove obsolete LONG_USAGE which breaks xgettext
>   i18n: am: mark more strings for translation
>   Remove unused and bad gettext block from git-am
>   i18n: merge-recursive: mark strings for translation

I do not understand why many of these have Stefano's S-o-b in them.
If you are relaying what Stefano originally wrote, then the author
(i.e. "From: ") and the first S-o-b would say Stefano, and your
S-o-b will follow it, but that is probably not the case.

I'll drop the S-o-b lines for now.

By the way, is there any existing test that needs to gain GETTEXT_POISON
or test_i18ncmp with this change?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-22 19:47 ` [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Junio C Hamano
@ 2012-07-23  3:14   ` Jiang Xin
  2012-07-23  4:36     ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-23  3:14 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð,
	Nguyễn Thái Ngọc, Stefano Lattarini

2012/7/23 Junio C Hamano <gitster@pobox.com>:
> I do not understand why many of these have Stefano's S-o-b in them.
> If you are relaying what Stefano originally wrote, then the author
> (i.e. "From: ") and the first S-o-b would say Stefano, and your
> S-o-b will follow it, but that is probably not the case.
> I'll drop the S-o-b lines for now.

It is because Stefano offers lots of help for correcting syntax errors
and misspellings in the original commit logs. Should I use Reviewed-by
tag instead of S-o-b?

And in PATCH 3/7, there is a Ævar's S-o-b, it is because the workaround
comes from Ævar's idea. Is this tag suitable? I think I should add a Reported-by
tag for Vincent, as he report it first in this mail:

    http://thread.gmane.org/gmane.comp.version-control.git/199042

> By the way, is there any existing test that needs to gain GETTEXT_POISON
> or test_i18ncmp with this change?

I find one test case failed, and correct it in PATCH 3/7.

-- 
Jiang Xin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-23  3:14   ` Jiang Xin
@ 2012-07-23  4:36     ` Junio C Hamano
  2012-07-23  7:32       ` Jiang Xin
  0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2012-07-23  4:36 UTC (permalink / raw)
  To: Jiang Xin
  Cc: Git List, Ævar Arnfjörð,
	Nguyễn Thái Ngọc, Stefano Lattarini

Jiang Xin <worldhello.net@gmail.com> writes:

> 2012/7/23 Junio C Hamano <gitster@pobox.com>:
>> I do not understand why many of these have Stefano's S-o-b in them.
>> If you are relaying what Stefano originally wrote, then the author
>> (i.e. "From: ") and the first S-o-b would say Stefano, and your
>> S-o-b will follow it, but that is probably not the case.
>> I'll drop the S-o-b lines for now.
>
> It is because Stefano offers lots of help for correcting syntax errors
> and misspellings in the original commit logs. Should I use Reviewed-by
> tag instead of S-o-b?

Yeah, I guessed that you meant reviewed-by.

> And in PATCH 3/7, there is a Ævar's S-o-b, it is because the workaround
> comes from Ævar's idea.

This one I remember the previous round, so didn't have any problem.

>> By the way, is there any existing test that needs to gain GETTEXT_POISON
>> or test_i18ncmp with this change?
>
> I find one test case failed, and correct it in PATCH 3/7.

That test used i18ncmp already, so the update to expected string
would be sufficient.  I was worried if there were existing tests
that have been expecting that the output from am/rebase/merge would
not be i18n'ised and using "test_cmp expect actual" to compare their
output with expected result.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-23  4:36     ` Junio C Hamano
@ 2012-07-23  7:32       ` Jiang Xin
  2012-07-23  7:38         ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 16+ messages in thread
From: Jiang Xin @ 2012-07-23  7:32 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git List, Ævar Arnfjörð,
	Nguyễn Thái Ngọc, Stefano Lattarini

2012/7/23 Junio C Hamano <gitster@pobox.com>:
>> I find one test case failed, and correct it in PATCH 3/7.
>
> That test used i18ncmp already, so the update to expected string
> would be sufficient.  I was worried if there were existing tests
> that have been expecting that the output from am/rebase/merge would
> not be i18n'ised and using "test_cmp expect actual" to compare their
> output with expected result.

If build git with GETTEXT_POISON and test, lots of test cases failed.
It seems that we haven't run these test cases for i18n for a long time.

test of t0006-date.sh failed, because of i18n in commit 7d29af.

    7d29a i18n: mark relative dates for translation

test of t0040-parse-options.sh failed, because of i18n in commit 54e6dc7:

    54e6d i18n: parseopt: lookup help and argument translations when
showing usage

I will try to fix them in next version of the patches.

Test Summary Report
-------------------
./t0006-date.sh                                    (Wstat: 256 Tests:
45 Failed: 11)
  Failed tests:  1-11
  Non-zero exit status: 1
./t0050-filesystem.sh                              (Wstat: 0 Tests: 10
Failed: 0)
  TODO passed:   6
./t0040-parse-options.sh                           (Wstat: 256 Tests:
36 Failed: 4)
  Failed tests:  1, 11-12, 27
  Non-zero exit status: 1
./t1502-rev-parse-parseopt.sh                      (Wstat: 256 Tests:
8 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
./t1450-fsck.sh                                    (Wstat: 256 Tests:
16 Failed: 1)
  Failed test:  13
  Non-zero exit status: 1
./t1300-repo-config.sh                             (Wstat: 256 Tests:
104 Failed: 1)
  Failed test:  48
  Non-zero exit status: 1
./t2006-checkout-index-basic.sh                    (Wstat: 256 Tests:
2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 1
./t2107-update-index-basic.sh                      (Wstat: 256 Tests:
3 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
./t3004-ls-files-basic.sh                          (Wstat: 256 Tests:
4 Failed: 2)
  Failed tests:  3-4
  Non-zero exit status: 1
./t3200-branch.sh                                  (Wstat: 256 Tests:
82 Failed: 2)
  Failed tests:  3, 10
  Non-zero exit status: 1
./t3406-rebase-message.sh                          (Wstat: 256 Tests:
6 Failed: 1)
  Failed test:  6
  Non-zero exit status: 1
./t3400-rebase.sh                                  (Wstat: 256 Tests:
26 Failed: 4)
  Failed tests:  5-8
  Non-zero exit status: 1
./t3501-revert-cherry-pick.sh                      (Wstat: 256 Tests:
7 Failed: 2)
  Failed tests:  2-3
  Non-zero exit status: 1
./t4006-diff-mode.sh                               (Wstat: 256 Tests:
7 Failed: 4)
  Failed tests:  4-7
  Non-zero exit status: 1
./t4012-diff-binary.sh                             (Wstat: 256 Tests:
13 Failed: 2)
  Failed tests:  7-8
  Non-zero exit status: 1
./t4035-diff-quiet.sh                              (Wstat: 256 Tests:
20 Failed: 3)
  Failed tests:  16, 18, 20
  Non-zero exit status: 1
./t4120-apply-popt.sh                              (Wstat: 256 Tests:
8 Failed: 2)
  Failed tests:  3, 5
  Non-zero exit status: 1
./t4133-apply-filenames.sh                         (Wstat: 256 Tests:
2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
./t4200-rerere.sh                                  (Wstat: 256 Tests:
25 Failed: 2)
  Failed tests:  24-25
  Non-zero exit status: 1
./t4205-log-pretty-formats.sh                      (Wstat: 256 Tests:
13 Failed: 1)
  Failed test:  12
  Non-zero exit status: 1
./t4202-log.sh                                     (Wstat: 256 Tests:
33 Failed: 1)
  Failed test:  33
  Non-zero exit status: 1
./t3903-stash.sh                                   (Wstat: 256 Tests:
46 Failed: 1)
  Failed test:  45
  Non-zero exit status: 1
./t5300-pack-object.sh                             (Wstat: 256 Tests:
33 Failed: 2)
  Failed tests:  32-33
  Non-zero exit status: 1
./t5505-remote.sh                                  (Wstat: 256 Tests:
68 Failed: 9)
  Failed tests:  2-3, 6-9, 13, 15, 46
  Non-zero exit status: 1
./t5530-upload-pack-error.sh                       (Wstat: 256 Tests:
10 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
./t6500-gc.sh                                      (Wstat: 256 Tests:
3 Failed: 2)
  Failed tests:  2-3
  Non-zero exit status: 1
./t6042-merge-rename-corner-cases.sh               (Wstat: 256 Tests:
26 Failed: 1)
  Failed test:  18
  Non-zero exit status: 1
./t6022-merge-rename.sh                            (Wstat: 256 Tests:
46 Failed: 3)
  Failed tests:  12, 15-16
  Non-zero exit status: 1
./t7008-grep-binary.sh                             (Wstat: 0 Tests: 20
Failed: 0)
  TODO passed:   12
./t7508-status.sh                                  (Wstat: 256 Tests:
76 Failed: 1)
  Failed test:  5
  Non-zero exit status: 1
./t7600-merge.sh                                   (Wstat: 256 Tests:
48 Failed: 1)
  Failed test:  3
  Non-zero exit status: 1
./t9903-bash-prompt.sh                             (Wstat: 256 Tests:
44 Failed: 6)
  Failed tests:  6, 8, 12-15
  Non-zero exit status: 1
Files=595, Tests=8548, 739 wallclock secs ( 5.05 usr  2.11 sys +
362.59 cusr 466.00 csys = 835.75 CPU)
Result: FAIL

-- 
Jiang Xin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-23  7:32       ` Jiang Xin
@ 2012-07-23  7:38         ` Nguyen Thai Ngoc Duy
  2012-07-23  8:01           ` Jiang Xin
  0 siblings, 1 reply; 16+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-07-23  7:38 UTC (permalink / raw)
  To: Jiang Xin
  Cc: Junio C Hamano, Git List, Ævar Arnfjörð,
	Stefano Lattarini

On Mon, Jul 23, 2012 at 2:32 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
> If build git with GETTEXT_POISON and test, lots of test cases failed.
> It seems that we haven't run these test cases for i18n for a long time.

Gaah.. I should have resent the poison-fix series but so far
procrastination is winning. Will do it soon.
-- 
Duy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge
  2012-07-23  7:38         ` Nguyen Thai Ngoc Duy
@ 2012-07-23  8:01           ` Jiang Xin
  0 siblings, 0 replies; 16+ messages in thread
From: Jiang Xin @ 2012-07-23  8:01 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy
  Cc: Junio C Hamano, Git List, Ævar Arnfjörð,
	Stefano Lattarini

2012/7/23 Nguyen Thai Ngoc Duy <pclouds@gmail.com>:
> On Mon, Jul 23, 2012 at 2:32 PM, Jiang Xin <worldhello.net@gmail.com> wrote:
>> If build git with GETTEXT_POISON and test, lots of test cases failed.
>> It seems that we haven't run these test cases for i18n for a long time.
>
> Gaah.. I should have resent the poison-fix series but so far
> procrastination is winning. Will do it soon.

So, I will just try to fix what I am responsible for\x10.

-- 
Jiang Xin

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-07-23  8:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-22  1:26 [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Jiang Xin
2012-07-22  1:26 ` [PATCH v2 1/7] i18n: New keywords for xgettext extraction from sh Jiang Xin
2012-07-22  1:26   ` [PATCH v2 2/7] i18n: rebase: mark strings for translation Jiang Xin
2012-07-22  1:26     ` [PATCH v2 3/7] i18n: Rewrite gettext messages start with dash Jiang Xin
2012-07-22  1:26       ` [PATCH v2 4/7] Remove obsolete LONG_USAGE which breaks xgettext Jiang Xin
2012-07-22  1:26         ` [PATCH v2 5/7] i18n: am: mark more strings for translation Jiang Xin
2012-07-22  1:26           ` [PATCH v2 6/7] Remove unused and bad gettext block from git-am Jiang Xin
2012-07-22  1:26             ` [PATCH v2 7/7] i18n: merge-recursive: mark strings for translation Jiang Xin
2012-07-22 19:37               ` Junio C Hamano
2012-07-22 19:04     ` [PATCH v2 2/7] i18n: rebase: " Junio C Hamano
2012-07-22 19:47 ` [PATCH v2 0/7] i18n for git-am, git-rebase and git-merge Junio C Hamano
2012-07-23  3:14   ` Jiang Xin
2012-07-23  4:36     ` Junio C Hamano
2012-07-23  7:32       ` Jiang Xin
2012-07-23  7:38         ` Nguyen Thai Ngoc Duy
2012-07-23  8:01           ` Jiang Xin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.