Skip to contentSkip to conversation

Add gettext support to Git

PATCH In review Ævar Arnfjörð Bjarmason 3 participants 47 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add gettext support to Git

This series continues work where the already pulled ab/i18n series (now merged to pu) left off.

It can also be pulled from:

    git://github.com/avar/git.git ab/i18n-continue
    http://github.com/avar/git/compare/ab/i18n-in-git-2010-09-07...ab/i18n-continue
    http://github.com/avar/git/compare/ab/i18n-in-git-2010-09-07...ab/i18n-continue.patch

It includes the first translation of a mainporcelain command written in shellscript (git-am). Comments on invividual patches below.

Ævar Arnfjörð Bjarmason (20):
gettextize: git-clean clean.requireForce braces
gettextize: git-clone "Cloning into" message braces

Under GCC this warns under -Wall and will presumably break Junio's -Werror build. I didn't notice because I use clang which (IMO rightly) doesn't complain about this.

po/de.po: make the German translation msgfmt --check clean

We'll see what ze Germans come up with translation wise, but meanwhile this un-breaks the translation already in ab/i18n.

Makefile: add GNU_GETTEXT, set when we expect GNU gettext
Makefile: MSGFMT="msgfmt --check" under GNU_GETTEXT

And these two patches make sure that a translation will never break like that again. Since msgfmt --check is a GNU-ism I needed to add support for GNU_GETTEXT=YesPlease in the Makefile.

Maybe a check for this could be added to the configure.ac script, but I couldn't find a way to do so, and for the reasons explained in the patches I don't think it was worth my time.

Revert "gettextize: git-revert mark the "me" variable for
translation"

Revert this as discussion on-list. Alternatively the "gettextize:
git-revert mark the "me" variable for translation" patch could be ejected from the existing ab/i18n series.

gettextize: git-revert "Your local changes" message
gettextize: git-revert literal "me" messages

Do The Right Thing when translating the "me" messsages.

gettext: add GETTEXT_POISON support for shell scripts
gettext: add GETTEXT_POISON tests for shell scripts

We need poison for .sh too to ensure sanity.

gettextize: git-am add git-sh-i18n
gettextize: git-am one-line gettext $msg; echo
gettextize: git-am multi-line getttext $msg; echo
gettextize: git-am eval_gettext messages
gettextize: git-am die messages
gettextize: git-am cannot_fallback messages

Note: Isn't --check clean because the existing code indented with spaces.

gettextize: git-am clean_abort messages
gettextize: git-am "Apply?" message
gettextize: git-am core say messages
gettextize: git-am printf(1) message to eval_gettext

All these git-am patches are split up like this to make it easier to review them, and to demonstrate the different sort of messages we'll have to translate in the shell scripts.

I won't sent commits quite so granular in the future (unless requested).

 Makefile                     |   16 +++++++++
 builtin/clean.c              |    3 +-
 builtin/clone.c              |    3 +-
 builtin/revert.c             |   32 +++++++++++------
 git-am.sh                    |   68 +++++++++++++++++++-----------------
 git-sh-i18n.sh               |   77 +++++++++++++++++++++++++----------------
 po/de.po                     |   11 +++---
 t/t0201-gettext-fallbacks.sh |   12 +++---
 t/t0201-gettext-poison.sh    |   36 +++++++++++++++++++
 t/t4150-am.sh                |    4 ++-
 t/t4151-am-abort.sh          |    2 +-
 t/test-lib.sh                |    9 ++++-
 12 files changed, 184 insertions(+), 89 deletions(-)
 create mode 100755 t/t0201-gettext-poison.sh
Signature · 1 line
1.7.2.3.313.gcd15
#1 lore raw

PATCH 1/20 gettextize: git-clean clean.requireForce braces

Use braces around a nested if/if/else to appease GCC, which'll whine under -Wall and "suggest explicit braces to avoid ambiguous ‘else’".

This code was originally added in "gettextize: git-clean clean.requireForce messages", and tested under clang (which doesn't whine about perfectly valid uses of C).

---
 builtin/clean.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
builtin/clean.c +2 -1
index 50ade84..52ec17a 100644
@@ -77,13 +77,14 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 	if (ignored && ignored_only)
 		die(_("-x and -X cannot be used together"));
 
-	if (!show_only && !force)
+	if (!show_only && !force) {
 		if (config_set)
 			die(_("clean.requireForce set to true and neither -n nor -f given; "
 				  "refusing to clean"));
 		else
 			die(_("clean.requireForce defaults to true and neither -n nor -f given; "
 				  "refusing to clean"));
+	}
 
 	if (force > 1)
 		rm_flags = 0;
Signature · 1 line
1.7.2.3.313.gcd15
#2 lore raw

PATCH 2/20 gettextize: git-clone "Cloning into" message braces

In reply to Ævar Arnfjörð Bjarmason

Use braces around a nested if/if/else to appease GCC, which'll whine under -Wall and "suggest explicit braces to avoid ambiguous ‘else’".

This code was originally added in "gettextize: git-clone "Cloning into" message", and tested under clang (which doesn't whine about perfectly valid uses of C).

---
 builtin/clone.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
builtin/clone.c +2 -1
index 7b0d104..1f10f3f 100644
@@ -465,11 +465,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		die(_("could not create leading directories of '%s'"), git_dir);
 	set_git_dir(make_absolute_path(git_dir));
 
-	if (0 <= option_verbosity)
+	if (0 <= option_verbosity) {
 		if (option_bare)
 			printf(_("Cloning into bare repository %s"), dir);
 		else
 			printf(_("Cloning into %s"), dir);
+	}
 	init_db(option_template, INIT_DB_QUIET);
 
 	/*
Signature · 1 line
1.7.2.3.313.gcd15
#3 lore raw

PATCH 4/20 Makefile: add GNU_GETTEXT, set when we expect GNU gettext

In reply to Ævar Arnfjörð Bjarmason

Add a GNU_GETTEXT flag that's set to YesPlease by default everywhere but on Solaris if the NO_GETTEXT flag isn't set.

Everyone uses GNU gettext these days except Solaris developers, so having a dumb check for this that just depends on SunOS should be OK.

I also don't plan to use this (for the time being) for anything that would break if it isn't correctly set (e.g. if you're using GNU libintl on Solaris), so I haven't added paranoid autoconf guards.

---
 Makefile |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Makefile +12 -0
index f26fca3..3fe2e47 100644
@@ -43,6 +43,11 @@ all::
 # on platforms where we don't expect glibc (Linux, Hurd,
 # GNU/kFreeBSD), which includes libintl.
 #
+# Define GNU_GETTEXT if you're using the GNU implementation of
+# libintl. We define this everywhere except on Solaris, which has its
+# own gettext implementation. If GNU_GETTEXT is set we'll use GNU
+# extensions like `msgfmt --check'.
+#
 # Define GETTEXT_POISON to turn all strings that use gettext into
 # gibberish. This option should only be used by the Git developers to
 # check that the Git gettext implementation itself is sane.
@@ -783,6 +788,10 @@ EXTLIBS =
 ifndef NO_GETTEXT
 	# Systems that use GNU gettext and glibc are the exception
 	NEEDS_LIBINTL = YesPlease
+
+	# Systems that don't use GNU gettext are the exception. Only
+	# Solaris has a mature non-GNU gettext implementation.
+	GNU_GETTEXT = YesPlease
 endif
 
 # We choose to avoid "if .. else if .. else .. endif endif"
@@ -872,6 +881,9 @@ ifeq ($(uname_S),SunOS)
 	NO_MKDTEMP = YesPlease
 	NO_MKSTEMPS = YesPlease
 	NO_REGEX = YesPlease
+ifndef NO_GETTEXT
+	GNU_GETTEXT =
+endif
 	ifeq ($(uname_R),5.6)
 		SOCKLEN_T = int
 		NO_HSTRERROR = YesPlease
Signature · 1 line
1.7.2.3.313.gcd15
#4 lore raw

PATCH 5/20 Makefile: MSGFMT="msgfmt --check" under GNU_GETTEXT

In reply to Ævar Arnfjörð Bjarmason

GNU msgfmt(1) supports the --check parameter which does various sanity checks on the translated strings we're processing, including checks that the printf(3) format of "c-format" translations matches the original. I.e. that a "%s" isn't missing, or that there aren't spurious or missing newlines in the translation.

Since Solaris msgfmt(1) doesn't support --check we have to wrap this in `ifdef GNU_GETTEXT'.

---
 Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Makefile +4 -0
index 3fe2e47..38ae13f 100644
@@ -1523,6 +1523,10 @@ ifdef NEEDS_LIBINTL
 	EXTLIBS += -lintl
 endif
 
+ifdef GNU_GETTEXT
+	MSGFMT += --check
+endif
+
 ifdef GETTEXT_POISON
 	COMPAT_CFLAGS += -DGETTEXT_POISON
 endif
Signature · 1 line
1.7.2.3.313.gcd15
#5 lore raw

PATCH 6/20 Revert "gettextize: git-revert mark the "me" variable for translation"

In reply to Ævar Arnfjörð Bjarmason

The `me' variable can be either "revert" or "cherry-pick". Some of these should be translated, but it's used in too many different contexts for the approach I initially took to be useful.

---
 builtin/revert.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
builtin/revert.c +1 -3
index 7157ee1..a93a5ba 100644
@@ -553,9 +553,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	struct rev_info revs;
 
 	git_config(git_default_config, NULL);
-	/* TRANSLATORS: This is used in several error messages indicating
-	   the name of the current program */
-	me = action == REVERT ? N_("revert") : N_("cherry-pick");
+	me = action == REVERT ? "revert" : "cherry-pick";
 	setenv(GIT_REFLOG_ACTION, me, 0);
 	parse_args(argc, argv);
 
Signature · 1 line
1.7.2.3.313.gcd15
#6 lore raw

PATCH 7/20 gettextize: git-revert "Your local changes" message

In reply to Ævar Arnfjörð Bjarmason

Translate the "Your local changes [...]" message without using the `me' variable, instead split up the two messages so translators can translate the whole messages as-is.

---
 builtin/revert.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
builtin/revert.c +13 -5
index a93a5ba..ad2c76a 100644
@@ -285,11 +285,19 @@ static NORETURN void die_dirty_index(const char *me)
 	if (read_cache_unmerged()) {
 		die_resolve_conflict(me);
 	} else {
-		if (advice_commit_before_merge)
-			die(_("Your local changes would be overwritten by %s.\n"
-			    "Please, commit your changes or stash them to proceed."), _(me));
-		else
-			die(_("Your local changes would be overwritten by %s.\n"), _(me));
+		if (advice_commit_before_merge) {
+			if (action == REVERT)
+				die(_("Your local changes would be overwritten by revert.\n"
+					  "Please, commit your changes or stash them to proceed."));
+			else
+				die(_("Your local changes would be overwritten by cherry-pick.\n"
+					  "Please, commit your changes or stash them to proceed."));
+		} else {
+			if (action == REVERT)
+				die("Your local changes would be overwritten by revert.\n");
+			else
+				die("Your local changes would be overwritten by cherry-pick.\n");
+		}
 	}
 }
 
Signature · 1 line
1.7.2.3.313.gcd15
#7 lore raw

PATCH 8/20 gettextize: git-revert literal "me" messages

In reply to Ævar Arnfjörð Bjarmason

Redo the translation of the remaining messages that used the `me' variable. These are all error messages referencing the command name, so the name shouldn't be translated.

---
 builtin/revert.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
builtin/revert.c +7 -3
index ad2c76a..a89dd12 100644
@@ -347,7 +347,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
 	if (active_cache_changed &&
 	    (write_cache(index_fd, active_cache, active_nr) ||
 	     commit_locked_index(&index_lock)))
-		die(_("%s: Unable to write new index file"), _(me));
+		/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+		die(_("%s: Unable to write new index file"), me);
 	rollback_lock_file(&index_lock);
 
 	if (!clean) {
@@ -454,8 +455,10 @@ static int do_pick_commit(void)
 		return fast_forward_to(commit->object.sha1, head);
 
 	if (parent && parse_commit(parent) < 0)
+		/* TRANSLATORS: The first %s will be "revert" or
+		   "cherry-pick", the second %s a SHA1 */
 		die(_("%s: cannot parse parent commit %s"),
-		    _(me), sha1_to_hex(parent->object.sha1));
+		    me, sha1_to_hex(parent->object.sha1));
 
 	if (get_message(commit->buffer, &msg) != 0)
 		die(_("Cannot get commit message for %s"),
@@ -577,7 +580,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 	}
 
 	if (read_cache() < 0)
-		die(_("git %s: failed to read the index"), _(me));
+		/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+		die(_("git %s: failed to read the index"), me);
 
 	prepare_revs(&revs);
 
Signature · 1 line
1.7.2.3.313.gcd15
#8 lore raw

PATCH 9/20 gettext: add GETTEXT_POISON support for shell scripts

In reply to Ævar Arnfjörð Bjarmason

Expand the existing GETTEXT_POISON=YesPlease support to support shell scripts. Analogous the existing C support this is needed to test that changes to the output of the shell scripts don't break the plumbing output.

---
 git-sh-i18n.sh               |   73 ++++++++++++++++++++++++++----------------
 t/t0201-gettext-fallbacks.sh |   12 +++---
 t/test-lib.sh                |    8 ++++-
 3 files changed, 58 insertions(+), 35 deletions(-)
git-sh-i18n.sh +45 -28
index 698a000..b8b645a 100644
@@ -28,44 +28,61 @@ else
 fi
 export TEXTDOMAINDIR
 
-if test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && type gettext.sh >/dev/null 2>&1
+if test -z "$GIT_INTERNAL_GETTEXT_GETTEXT_POISON"
 then
-	# This is GNU libintl's gettext.sh, we don't need to do anything
-	# else than setting up the environment and loading gettext.sh
-	GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu
-	export GIT_INTERNAL_GETTEXT_SH_SCHEME
+	if test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && type gettext.sh >/dev/null 2>&1
+	then
+		# This is GNU libintl's gettext.sh, we don't need to do anything
+		# else than setting up the environment and loading gettext.sh
+		GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu
+		export GIT_INTERNAL_GETTEXT_SH_SCHEME
 
-	# Try to use libintl's gettext.sh, or fall back to English if we
-	# can't.
-	. gettext.sh
-elif test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && test "$(gettext -h 2>&1)" = "-h"
-then
-	# We don't have gettext.sh, but there's a gettext binary in our
-	# path. This is probably Solaris or something like it which has a
-	# gettext implementation that isn't GNU libintl.
-	GIT_INTERNAL_GETTEXT_SH_SCHEME=solaris
-	export GIT_INTERNAL_GETTEXT_SH_SCHEME
+		# Try to use libintl's gettext.sh, or fall back to English if we
+		# can't.
+		. gettext.sh
+	elif test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && test "$(gettext -h 2>&1)" = "-h"
+	then
+		# We don't have gettext.sh, but there's a gettext binary in our
+		# path. This is probably Solaris or something like it which has a
+		# gettext implementation that isn't GNU libintl.
+		GIT_INTERNAL_GETTEXT_SH_SCHEME=solaris
+		export GIT_INTERNAL_GETTEXT_SH_SCHEME
 
-	# Solaris has a gettext(1) but no eval_gettext(1)
-	eval_gettext () {
-		gettext_out=$(gettext "$1")
-		gettext_eval="printf '%s' \"$gettext_out\""
-		printf "%s" "`eval \"$gettext_eval\"`"
-	}
+		# Solaris has a gettext(1) but no eval_gettext(1)
+		eval_gettext () {
+			gettext_out=$(gettext "$1")
+			gettext_eval="printf '%s' \"$gettext_out\""
+			printf "%s" "`eval \"$gettext_eval\"`"
+		}
+	else
+		# Since gettext.sh isn't available we'll have to define our own
+		# dummy pass-through functions.
+
+		# Tell our tests that we don't have the real gettext.sh
+		GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
+		export GIT_INTERNAL_GETTEXT_SH_SCHEME
+
+		gettext () {
+			printf "%s" "$1"
+		}
+
+		eval_gettext () {
+			gettext_eval="printf '%s' \"$1\""
+			printf "%s" "`eval \"$gettext_eval\"`"
+		}
+	fi
 else
-	# Since gettext.sh isn't available we'll have to define our own
-	# dummy pass-through functions.
+	# Emit garbage under GETTEXT_POISON=YesPlease. Unlike the C tests
+	# this relies on an environment variable
 
-	# Tell our tests that we don't have the real gettext.sh
-	GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
+	GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
 	export GIT_INTERNAL_GETTEXT_SH_SCHEME
 
 	gettext () {
-		printf "%s" "$1"
+		printf "%s" "# GETTEXT POISON #"
 	}
 
 	eval_gettext () {
-		gettext_eval="printf '%s' \"$1\""
-		printf "%s" "`eval \"$gettext_eval\"`"
+		printf "%s" "# GETTEXT POISON #"
 	}
 fi
t/t0201-gettext-fallbacks.sh +6 -6
index 47ce4f6..7a85d9b 100755
@@ -10,19 +10,19 @@ export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS
 
 . ./lib-gettext.sh
 
-test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
+test_expect_success NO_GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
     test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
 '
 
-test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
+test_expect_success NO_GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_TEST_FALLBACKS is set' '
     test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
 '
 
-test_expect_success 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
+test_expect_success NO_GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is fallthrough' '
     test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "fallthrough"
 '
 
-test_expect_success 'gettext: our gettext() fallback has pass-through semantics' '
+test_expect_success NO_GETTEXT_POISON 'gettext: our gettext() fallback has pass-through semantics' '
     printf "test" >expect &&
     gettext "test" >actual &&
     test_cmp expect actual &&
@@ -31,7 +31,7 @@ test_expect_success 'gettext: our gettext() fallback has pass-through semantics'
     test_cmp expect actual
 '
 
-test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
+test_expect_success NO_GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback has pass-through semantics' '
     printf "test" >expect &&
     eval_gettext "test" >actual &&
     test_cmp expect actual &&
@@ -40,7 +40,7 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback has pass-through
     test_cmp expect actual
 '
 
-test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
+test_expect_success NO_GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback can interpolate variables' '
     printf "test YesPlease" >expect &&
     eval_gettext "test \$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" >actual &&
     test_cmp expect actual
t/test-lib.sh +7 -1
index b297ef6..5a9f989 100644
@@ -963,7 +963,13 @@ esac
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
-test -z "$GETTEXT_POISON" && test_set_prereq NO_GETTEXT_POISON
+if test -z "$GETTEXT_POISON"
+then
+	test_set_prereq NO_GETTEXT_POISON
+else
+	GIT_INTERNAL_GETTEXT_GETTEXT_POISON=YesPlease
+	export GIT_INTERNAL_GETTEXT_GETTEXT_POISON
+fi
 
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
Signature · 1 line
1.7.2.3.313.gcd15
#9 lore raw

PATCH 10/20 gettext: add GETTEXT_POISON tests for shell scripts

In reply to Ævar Arnfjörð Bjarmason

Test the new GETTEXT_POISON=YesPlease support for shell scripts. This test is derived from the existing t0201-gettext-fallbacks.sh test.

---
 t/t0201-gettext-poison.sh |   36 ++++++++++++++++++++++++++++++++++++
 t/test-lib.sh             |    1 +
 2 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100755 t/t0201-gettext-poison.sh
t/t0201-gettext-poison.sh new file +36 -0
new file mode 100755
index 0000000..2361590
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+#
+
+test_description='Gettext Shell poison'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
+    test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME"
+'
+
+test_expect_success GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is poison' '
+    test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "poison"
+'
+
+test_expect_success GETTEXT_POISON 'gettext: our gettext() fallback has poison semantics' '
+    printf "# GETTEXT POISON #" >expect &&
+    gettext "test" >actual &&
+    test_cmp expect actual &&
+    printf "# GETTEXT POISON #" >expect &&
+    gettext "test more words" >actual &&
+    test_cmp expect actual
+'
+
+test_expect_success GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback has poison semantics' '
+    printf "# GETTEXT POISON #" >expect &&
+    eval_gettext "test" >actual &&
+    test_cmp expect actual &&
+    printf "# GETTEXT POISON #" >expect &&
+    eval_gettext "test more words" >actual &&
+    test_cmp expect actual
+'
+
+test_done
t/test-lib.sh +1 -0
index 5a9f989..48e1256 100644
@@ -967,6 +967,7 @@ if test -z "$GETTEXT_POISON"
 then
 	test_set_prereq NO_GETTEXT_POISON
 else
+	test_set_prereq GETTEXT_POISON
 	GIT_INTERNAL_GETTEXT_GETTEXT_POISON=YesPlease
 	export GIT_INTERNAL_GETTEXT_GETTEXT_POISON
 fi
Signature · 1 line
1.7.2.3.313.gcd15
#10 lore raw

PATCH 11/20 gettextize: git-am add git-sh-i18n

In reply to Ævar Arnfjörð Bjarmason

Source git-sh-i18n in git-am.sh, it's needed to import the Git gettext shell functions.

---
 git-am.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-am.sh +1 -0
index e7f008c..a7185d9 100755
@@ -37,6 +37,7 @@ rerere-autoupdate update the index with reused conflict resolution if possible
 rebasing*       (internal use for git-rebase)"
 
 . git-sh-setup
+. git-sh-i18n
 prefix=$(git rev-parse --show-prefix)
 set_reflog_action am
 require_work_tree
Signature · 1 line
1.7.2.3.313.gcd15
#11 lore raw

PATCH 12/20 gettextize: git-am one-line gettext $msg; echo

In reply to Ævar Arnfjörð Bjarmason

One-line `gettext $msg; echo' messages are the simplest use case for gettext(1).

---
 git-am.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
git-am.sh +3 -3
index a7185d9..bd04a15 100755
@@ -93,7 +93,7 @@ go_next () {
 
 cannot_fallback () {
 	echo "$1"
-	echo "Cannot fall back to three-way merge."
+	gettext "Cannot fall back to three-way merge."; echo
 	exit 1
 }
 
@@ -629,7 +629,7 @@ do
 
 	if test -z "$GIT_AUTHOR_EMAIL"
 	then
-		echo "Patch does not have a valid e-mail address."
+		gettext "Patch does not have a valid e-mail address."; echo
 		stop_here $this
 	fi
 
@@ -680,7 +680,7 @@ do
 	    action=again
 	    while test "$action" = again
 	    do
-		echo "Commit Body is:"
+		gettext "Commit Body is:"; echo
 		echo "--------------------------"
 		cat "$dotest/final-commit"
 		echo "--------------------------"
Signature · 1 line
1.7.2.3.313.gcd15
#12 lore raw

PATCH 13/20 gettextize: git-am multi-line getttext $msg; echo

In reply to Ævar Arnfjörð Bjarmason

When we have multi-line `gettext $msg; echo' messages we can't preserve the existing indenting because gettext(1) can't accept input on stdin.

---
 git-am.sh |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
git-am.sh +5 -5
index bd04a15..73a4046 100755
@@ -741,16 +741,16 @@ do
 		# working tree.
 		resolved=
 		git diff-index --quiet --cached HEAD -- && {
-			echo "No changes - did you forget to use 'git add'?"
-			echo "If there is nothing left to stage, chances are that something else"
-			echo "already introduced the same changes; you might want to skip this patch."
+			gettext "No changes - did you forget to use 'git add'?
+If there is nothing left to stage, chances are that something else
+already introduced the same changes; you might want to skip this patch."; echo
 			stop_here_user_resolve $this
 		}
 		unmerged=$(git ls-files -u)
 		if test -n "$unmerged"
 		then
-			echo "You still have unmerged paths in your index"
-			echo "did you forget to use 'git add'?"
+			gettext "You still have unmerged paths in your index
+did you forget to use 'git add'?"; echo
 			stop_here_user_resolve $this
 		fi
 		apply_status=0
Signature · 1 line
1.7.2.3.313.gcd15
#13 lore raw

PATCH 14/20 gettextize: git-am eval_gettext messages

In reply to Ævar Arnfjörð Bjarmason

Messages that use variables to be interpolated need to use eval_gettext(), this wrapper will eval the message and expand the variable for us.

---
 git-am.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
git-am.sh +6 -6
index 73a4046..98819e6 100755
@@ -77,9 +77,9 @@ stop_here_user_resolve () {
 	    printf '%s\n' "$resolvemsg"
 	    stop_here $1
     fi
-    echo "When you have resolved this problem run \"$cmdline --resolved\"."
-    echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
-    echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
+    eval_gettext "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\"."; echo
 
     stop_here $1
 }
@@ -592,9 +592,9 @@ do
 			go_next && continue
 
 		test -s "$dotest/patch" || {
-			echo "Patch is empty.  Was it split wrong?"
-			echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
-			echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
+			eval_gettext "Patch is empty.  Was it split wrong?
+If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
+To restore the original branch and stop patching run \"\$cmdline --abort\"."; echo
 			stop_here $this
 		}
 		rm -f "$dotest/original-commit" "$dotest/author-script"
Signature · 1 line
1.7.2.3.313.gcd15
#14 lore raw

PATCH 15/20 gettextize: git-am die messages

In reply to Ævar Arnfjörð Bjarmason

The die messages in git-am need to use:

    die "$(gettext "string")"

Since gettext(1) emits the message instead of returning it like the C equivalent, and our die() function in git-sh-setup needs to get a string as an argument.

---
 git-am.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
git-am.sh +7 -7
index 98819e6..4bee325 100755
@@ -44,7 +44,7 @@ require_work_tree
 cd_to_toplevel
 
 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")"
 
 if git rev-parse --verify -q HEAD >/dev/null
 then
@@ -337,7 +337,7 @@ do
 	--rebasing)
 		rebasing=t threeway=t keep=t scissors=f no_inbody_headers=t ;;
 	-d|--dotest)
-		die "-d option is no longer supported.  Do not use."
+		die "$(gettext "-d option is no longer supported.  Do not use.")"
 		;;
 	--resolvemsg)
 		shift; resolvemsg=$1 ;;
@@ -400,12 +400,12 @@ then
 		false
 		;;
 	esac ||
-	die "previous rebase directory $dotest still exists but mbox given."
+	die "$(eval_gettext "previous rebase directory \$dotest still exists but mbox given.")"
 	resume=yes
 
 	case "$skip,$abort" in
 	t,t)
-		die "Please make up your mind. --skip or --abort?"
+		die "$(gettext "Please make up your mind. --skip or --abort?")"
 		;;
 	t,)
 		git rerere clear
@@ -431,7 +431,7 @@ then
 else
 	# Make sure we are not given --skip, --resolved, nor --abort
 	test "$skip$resolved$abort" = "" ||
-		die "Resolve operation not in progress, we are not resuming."
+		die "$(gettext "Resolve operation not in progress, we are not resuming.")"
 
 	# Start afresh.
 	mkdir -p "$dotest" || exit
@@ -496,7 +496,7 @@ case "$resolved" in
 	if test "$files"
 	then
 		test -n "$HAS_HEAD" && : >"$dotest/dirtyindex"
-		die "Dirty index: cannot apply patches (dirty: $files)"
+		die "$(eval_gettext "Dirty index: cannot apply patches (dirty: \$files)")"
 	fi
 esac
 
@@ -676,7 +676,7 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."; ec
 	if test "$interactive" = t
 	then
 	    test -t 0 ||
-	    die "cannot be interactive without stdin connected to a terminal."
+	    die "$(gettext "cannot be interactive without stdin connected to a terminal.")"
 	    action=again
 	    while test "$action" = again
 	    do
Signature · 1 line
1.7.2.3.313.gcd15
#15 lore raw

PATCH 16/20 gettextize: git-am cannot_fallback messages

In reply to Ævar Arnfjörð Bjarmason

Translate messages with gettext(1) before they're passed to the cannot_fallback function, just like we handle the die function.

---
 git-am.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
git-am.sh +3 -3
index 4bee325..8e894e5 100755
@@ -108,7 +108,7 @@ fall_back_3way () {
 	"$dotest/patch" &&
     GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
     git write-tree >"$dotest/patch-merge-base+" ||
-    cannot_fallback "Repository lacks necessary blobs to fall back on 3-way merge."
+    cannot_fallback "$(gettext "Repository lacks necessary blobs to fall back on 3-way merge.")"
 
     say Using index info to reconstruct a base tree...
     if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
@@ -117,8 +117,8 @@ fall_back_3way () {
 	mv "$dotest/patch-merge-base+" "$dotest/patch-merge-base"
 	mv "$dotest/patch-merge-tmp-index" "$dotest/patch-merge-index"
     else
-        cannot_fallback "Did you hand edit your patch?
-It does not apply to blobs recorded in its index."
+        cannot_fallback "$(gettext "Did you hand edit your patch?
+It does not apply to blobs recorded in its index.")"
     fi
 
     test -f "$dotest/patch-merge-index" &&
Signature · 1 line
1.7.2.3.313.gcd15
#16 lore raw

PATCH 17/20 gettextize: git-am clean_abort messages

In reply to Ævar Arnfjörð Bjarmason

Messages that used the clean_abort function needed both gettext(1) and eval_gettext(). These need to be interpolated in a string like the die and cannot_fallback messages.

---
 git-am.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
git-am.sh +3 -3
index 8e894e5..3403267 100755
@@ -233,7 +233,7 @@ split_patches () {
 	stgit-series)
 		if test $# -ne 1
 		then
-			clean_abort "Only one StGIT patch series can be applied at once"
+			clean_abort "$(gettext "Only one StGIT patch series can be applied at once")"
 		fi
 		series_dir=`dirname "$1"`
 		series_file="$1"
@@ -285,9 +285,9 @@ split_patches () {
 		;;
 	*)
 		if test -n "$parse_patch" ; then
-			clean_abort "Patch format $patch_format is not supported."
+			clean_abort "$(eval_gettext "Patch format \$patch_format is not supported.")"
 		else
-			clean_abort "Patch format detection failed."
+			clean_abort "$(gettext "Patch format detection failed.")"
 		fi
 		;;
 	esac
Signature · 1 line
1.7.2.3.313.gcd15
#17 lore raw

PATCH 18/20 gettextize: git-am "Apply?" message

In reply to Ævar Arnfjörð Bjarmason

Make the "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all" message translatable, and leave a note in a TRANSLATORS comment explaining that translators have to preserve a mention of the y/n/e/v/a characters since the program will expect them, and not their localized equivalents.

---
 git-am.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
git-am.sh +4 -1
index 3403267..90f2a9d 100755
@@ -684,7 +684,10 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."; ec
 		echo "--------------------------"
 		cat "$dotest/final-commit"
 		echo "--------------------------"
-		printf "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
+		# TRANSLATORS: Make sure to include [y], [n], [e], [v] and [a]
+		# in your translation. The program will only accept English
+		# input at this point.
+		gettext "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
 		read reply
 		case "$reply" in
 		[yY]*) action=yes ;;
Signature · 1 line
1.7.2.3.313.gcd15
#18 lore raw

PATCH 19/20 gettextize: git-am core say messages

In reply to Ævar Arnfjörð Bjarmason

Make the core git-am messages that use say() translatable. These are visible on almost every git am invocation.

There are tests that depend on the "Applying" output that need to be skipped along with this translation.

---
 git-am.sh           |    6 +++---
 t/t4150-am.sh       |    4 +++-
 t/t4151-am-abort.sh |    2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)
git-am.sh +3 -3
index 90f2a9d..6992d92 100755
@@ -723,7 +723,7 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."; ec
 		stop_here $this
 	fi
 
-	say "Applying: $FIRSTLINE"
+	say "$(eval_gettext "Applying: \$FIRSTLINE")"
 
 	case "$resolved" in
 	'')
@@ -768,7 +768,7 @@ did you forget to use 'git add'?"; echo
 		    # Applying the patch to an earlier tree and merging the
 		    # result may have produced the same tree as ours.
 		    git diff-index --quiet --cached HEAD -- && {
-			say No changes -- Patch already applied.
+			say "$(gettext "No changes -- Patch already applied.")"
 			go_next
 			continue
 		    }
@@ -794,7 +794,7 @@ did you forget to use 'git add'?"; echo
 			GIT_AUTHOR_DATE=
 		fi
 		parent=$(git rev-parse --verify -q HEAD) ||
-		say >&2 "applying to an empty history"
+		say >&2 "$(gettext "applying to an empty history")"
 
 		if test -n "$committer_date_is_author_date"
 		then
t/t4150-am.sh +3 -1
index 1c3d8ed..59ba994 100755
@@ -464,7 +464,9 @@ test_expect_success 'am newline in subject' '
 	git checkout first &&
 	test_tick &&
 	sed -e "s/second/second \\\n foo/" patch1 >patchnl &&
-	git am <patchnl >output.out 2>&1 &&
+	git am <patchnl >output.out 2>&1'
+
+test_expect_success NO_GETTEXT_POISON 'output: am newline in subject' '
 	grep "^Applying: second \\\n foo$" output.out
 '
 
t/t4151-am-abort.sh +1 -1
index b55c411..5bb24f8 100755
@@ -43,7 +43,7 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "am$with3 --skip continue after failed am$with3" '
+	test_expect_success NO_GETTEXT_POISON "am$with3 --skip continue after failed am$with3" '
 		test_must_fail git am$with3 --skip >output &&
 		test "$(grep "^Applying" output)" = "Applying: 6" &&
 		test_cmp file-2-expect file-2 &&
Signature · 1 line
1.7.2.3.313.gcd15
#19 lore raw

PATCH 20/20 gettextize: git-am printf(1) message to eval_gettext

In reply to Ævar Arnfjörð Bjarmason

Convert a message that used printf(1) format to use eval_gettext. It's easier for translators to handle the latter, since the eval format automatically gives them context via variable names.

---
 git-am.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-am.sh +1 -1
index 6992d92..a13d488 100755
@@ -778,7 +778,7 @@ did you forget to use 'git add'?"; echo
 	fi
 	if test $apply_status != 0
 	then
-		printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
+		echo "$(eval_gettext "Patch failed at \$msgnum \$FIRSTLINE")"
 		stop_here_user_resolve $this
 	fi
 
Signature · 1 line
1.7.2.3.313.gcd15
#20 lore raw

PATCH v2 20/20 gettextize: git-am printf(1) message to eval_gettext

Convert a message that used printf(1) format to use eval_gettext. It's easier for translators to handle the latter, since the eval format automatically gives them context via variable names.

---

Use eval_gettext directly as suggested by Jonathan Nieder.

 git-am.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-am.sh +1 -1
index 6992d92..bf0258d 100755
@@ -778,7 +778,7 @@ did you forget to use 'git add'?"; echo
 	fi
 	if test $apply_status != 0
 	then
-		printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
+		eval_gettext 'Patch failed at $msgnum $FIRSTLINE'; echo
 		stop_here_user_resolve $this
 	fi
 
Signature · 1 line
1.7.2.3.313.gcd15
#21 lore raw

Re: [PATCH 20/20] gettextize: git-am printf(1) message to eval_gettext

In reply to Ævar Arnfjörð Bjarmason

Hi,

Quoted 7 lines · Ævar Arnfjörð Bjarmason

+++ b/git-am.sh

(quoted diff) +0 -0
@@ -778,7 +778,7 @@ did you forget to use 'git add'?"; echo

       fi
       if test $apply_status != 0
       then
-               printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
+               echo "$(eval_gettext "Patch failed at \$msgnum \$FIRSTLINE")"

Probably I am missing something silly, but why not just:

eval_gettext 'Patch failed at $msgnum $FIRSTLINE\n'

? I ask because it is nice to be able to avoid "echo" with arbitrary
data: special characters (e.g. \) can make for portability hassles.

Jonathan

#22 lore raw

Re: [PATCH 20/20] gettextize: git-am printf(1) message to eval_gettext

Quoted 14 lines · Jonathan Nieder

Hi,

Quoted 7 lines · Ævar Arnfjörð Bjarmason

+++ b/git-am.sh

(quoted diff) +0 -0
@@ -778,7 +778,7 @@ did you forget to use 'git add'?"; echo

       fi
       if test $apply_status != 0
       then
-               printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
+               echo "$(eval_gettext "Patch failed at \$msgnum \$FIRSTLINE")"

Probably I am missing something silly, but why not just:

Quoted 1 line

       eval_gettext 'Patch failed at $msgnum $FIRSTLINE\n'

That looks better, or:

eval_gettext 'Patch failed at $msgnum $FIRSTLINE'; echo

To remove the change for translators to screw up the \n, the gettext manual uses that style.

It also uses double quotes consistently, but '' works fine too. I don't know if '' should be avoided for some other reason, probably not.

Quoted 2 lines

? I ask because it is nice to be able to avoid "echo" with arbitrary
data: special characters (e.g. \) can make for portability hassles.

Aside from this example (which looks nicer as you suggest) we'd be in some slight trouble if the code in the patch is unportable, since I think I'm using equivalent constructions elsewhere to thinks that get passed to echo, but maybe that's not a problem if there's a level of indirection.

In any case we could solve those with printf "%s" $str.

#24 lore raw

PATCH v2 19/20 gettextize: git-am core say messages

In reply to Ævar Arnfjörð Bjarmason

Make the core git-am messages that use say() translatable. These are visible on almost every git am invocation.

There are tests that depend on the "Applying" output that need to be skipped along with this translation.

---

Fix for a trivial coding style issue:

-+ git am <patchnl >output.out 2>&1'
++ git am <patchnl >output.out 2>&1
++'

 git-am.sh           |    6 +++---
 t/t4150-am.sh       |    5 ++++-
 t/t4151-am-abort.sh |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)
git-am.sh +3 -3
index 90f2a9d..6992d92 100755
@@ -723,7 +723,7 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."; ec
 		stop_here $this
 	fi
 
-	say "Applying: $FIRSTLINE"
+	say "$(eval_gettext "Applying: \$FIRSTLINE")"
 
 	case "$resolved" in
 	'')
@@ -768,7 +768,7 @@ did you forget to use 'git add'?"; echo
 		    # Applying the patch to an earlier tree and merging the
 		    # result may have produced the same tree as ours.
 		    git diff-index --quiet --cached HEAD -- && {
-			say No changes -- Patch already applied.
+			say "$(gettext "No changes -- Patch already applied.")"
 			go_next
 			continue
 		    }
@@ -794,7 +794,7 @@ did you forget to use 'git add'?"; echo
 			GIT_AUTHOR_DATE=
 		fi
 		parent=$(git rev-parse --verify -q HEAD) ||
-		say >&2 "applying to an empty history"
+		say >&2 "$(gettext "applying to an empty history")"
 
 		if test -n "$committer_date_is_author_date"
 		then
t/t4150-am.sh +4 -1
index 1c3d8ed..373d79b 100755
@@ -464,7 +464,10 @@ test_expect_success 'am newline in subject' '
 	git checkout first &&
 	test_tick &&
 	sed -e "s/second/second \\\n foo/" patch1 >patchnl &&
-	git am <patchnl >output.out 2>&1 &&
+	git am <patchnl >output.out 2>&1
+'
+
+test_expect_success NO_GETTEXT_POISON 'output: am newline in subject' '
 	grep "^Applying: second \\\n foo$" output.out
 '
 
t/t4151-am-abort.sh +1 -1
index b55c411..5bb24f8 100755
@@ -43,7 +43,7 @@ do
 		test_cmp expect actual
 	'
 
-	test_expect_success "am$with3 --skip continue after failed am$with3" '
+	test_expect_success NO_GETTEXT_POISON "am$with3 --skip continue after failed am$with3" '
 		test_must_fail git am$with3 --skip >output &&
 		test "$(grep "^Applying" output)" = "Applying: 6" &&
 		test_cmp file-2-expect file-2 &&
Signature · 1 line
1.7.2.3.313.gcd15
#25 lore raw
In reply to Ævar Arnfjörð Bjarmason

I've done

git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

and rebuilt 'pu' with it (I am not quite ready to push the results out, though).

Please squash in the following to appropriate patches in the series. Thanks.

-- >8 --
From: Junio C Hamano <[email protected]>
Date: Wed, 8 Sep 2010 09:33:18 -0700
Subject: [PATCH] Style fixups: explicitly disambiguate nested if/if/else correspondence

Write {} to let the compiler know that we know what we are doing, like this, when writing a nested if/if/else:

    if (...) {
        if (...)
	    ...
	else
	    ...
    }

The programmer who writes the code like the above without the outermost {} may know that "else" corresponds to the innermost "if", but it will keep things easier and safer while reviewing patches that build on top of code like this.

---
 builtin/clean.c |    3 ++-
 builtin/clone.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
builtin/clean.c +2 -1
index 642d767..e1694c0 100644
@@ -77,13 +77,14 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 	if (ignored && ignored_only)
 		die(_("-x and -X cannot be used together"));
 
-	if (!show_only && !force)
+	if (!show_only && !force) {
 		if (config_set)
 			die(_("clean.requireForce set to true and neither -n nor -f given; "
 				  "refusing to clean"));
 		else
 			die(_("clean.requireForce defaults to true and neither -n nor -f given; "
 				  "refusing to clean"));
+	}
 
 	if (force > 1)
 		rm_flags = 0;
builtin/clone.c +2 -1
index 7b0d104..1f10f3f 100644
@@ -465,11 +465,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		die(_("could not create leading directories of '%s'"), git_dir);
 	set_git_dir(make_absolute_path(git_dir));
 
-	if (0 <= option_verbosity)
+	if (0 <= option_verbosity) {
 		if (option_bare)
 			printf(_("Cloning into bare repository %s"), dir);
 		else
 			printf(_("Cloning into %s"), dir);
+	}
 	init_db(option_template, INIT_DB_QUIET);
 
 	/*
Signature · 1 line
1.7.3.rc0.183.gb0497
#26 lore raw
Quoted 9 lines · Junio C Hamano

I've done

   git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

and rebuilt 'pu' with it (I am not quite ready to push the results out, though).

Please squash in the following to appropriate patches in the series. Thanks.

Thanks, those fixes were actually already part of the series, but I hadn't squashed those yet.

I've gone ahead and done so:

pick 8e9b49d gettextize: git-clone "Cloning into" message fixup 73f08a1 gettextize: git-clone "Cloning into" message braces

and:

pick 8e9b49d gettextize: git-clone "Cloning into" message fixup 73f08a1 gettextize: git-clone "Cloning into" message braces

I've also fixed up the whole mess with the "me" messages. I.e. dropped the revert commits and just fixed the originals so they make sense in the first place.

#27 lore raw
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 9 lines · Junio C Hamano

I've done

   git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

and rebuilt 'pu' with it (I am not quite ready to push the results out, though).

Please squash in the following to appropriate patches in the series. Thanks.

Thanks, those fixes were actually already part of the series, but I hadn't squashed those yet.

I've gone ahead and done so:

   pick 8e9b49d gettextize: git-clone "Cloning into" message fixup 73f08a1 gettextize: git-clone "Cloning into" message braces

Quoted 8 lines

and:

   pick 8e9b49d gettextize: git-clone "Cloning into" message fixup 73f08a1 gettextize: git-clone "Cloning into" message braces

I've also fixed up the whole mess with the "me" messages. I.e. dropped the revert commits and just fixed the originals so they make sense in the first place.

Hi, since you didn't pick this up in the last push I fixed it up a bit more.

I rebased ab/i18n-all-continue on the new master:

git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

But you probably want this instead:

git fetch git://github.com/avar/git +ab/i18n-all-continue-with-hindi:ab/i18n

I took the liberty of adding Ramkumar Ramachandra's hi.po patch to the series.

It also doesn't have your "Style fixups: explicitly disambiguate nested if/if/else correspondence" commit since I fixed that in my copy, and fixes the "me" issues by rewriting some old commits.

#28 lore raw
Quoted 5 lines · Ævar Arnfjörð Bjarmason

Hi, since you didn't pick this up in the last push I fixed it up a bit more.

I rebased ab/i18n-all-continue on the new master:

Quoted 8 lines

git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

But you probably want this instead:

git fetch git://github.com/avar/git +ab/i18n-all-continue-with-hindi:ab/i18n

I took the liberty of adding Ramkumar Ramachandra's hi.po patch to the series.

I think that the latter is "i18n-continue-with-hindi" (no "all"), and also suspect that ab/i18n-all-continue either hasn't be pushed out or is stale?

The copy of "all-continue" I just fetched ends with 2b5170f (gettextize:
git-shortlog basic messages, 2010-09-05) while hindi^ is at c4adf2e (gettextize: git-am printf(1) message to eval_gettext, 2010-09-07).

I haven't formed an opinion as to what to do with the *.po files after the series hits 'next' (or anything more stable than 'pu'); my preference is to delegate that part of the system to somebody who volunteers as an i18n coordinator, and pull from him/her from time to time, just like the way gitk and git-gui are managed.

For now, I'll queue the whole thing and merge that to 'pu', but we would want to squash l10n commits after (but not including) 8d65a35 (gettext
tests: test re-encoding with a UTF-8 msgid under Shell, 2010-08-30) that touch only one file in po/*.po into one commit per language, move them near the tip after all the infrastructure enhancements (and fix-ups to the infrastructure, if necessary) and individual command i18ns, to make the end result a reasonably complete and clean "first cut for public testing" of the series before it hits 'next'.

As a companion update to 6495411 (gettext docs: add po/README file documenting Git's gettext, 2010-09-03), we would need a file in Documentation/ directory to describe the use of _() and N_() for programmers and point it from CodingGuidelines. We might also want to move po/README to Documentation/ but I don't have strong preference either way.

Thanks.

#29 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 7 lines · Ævar Arnfjörð Bjarmason

Hi, since you didn't pick this up in the last push I fixed it up a bit more.

I rebased ab/i18n-all-continue on the new master:

    git fetch git://github.com/avar/git +ab/i18n-all-continue:ab/i18n

Quoted 8 lines
Quoted 6 lines

But you probably want this instead:

    git fetch git://github.com/avar/git +ab/i18n-all-continue-with-hindi:ab/i18n

I took the liberty of adding Ramkumar Ramachandra's hi.po patch to the series.

I think that the latter is "i18n-continue-with-hindi" (no "all")

Yes, sorry. It's just "ab/i18n-continue-with-hindi".

Quoted 2 lines

and also suspect that ab/i18n-all-continue either hasn't be pushed out or is stale?

Yes sorry, I pushed to "ab/i18n-continue"
instead. "ab/i18n-all-continue" is now up-to-date (equivalent to "ab/i18n-continue"). Sorry abuot the mixup.

Quoted 3 lines

The copy of "all-continue" I just fetched ends with 2b5170f (gettextize:
git-shortlog basic messages, 2010-09-05) while hindi^ is at c4adf2e (gettextize: git-am printf(1) message to eval_gettext, 2010-09-07).

The hindi^ one was the right tip.

Quoted 5 lines

I haven't formed an opinion as to what to do with the *.po files after the series hits 'next' (or anything more stable than 'pu'); my preference is to delegate that part of the system to somebody who volunteers as an i18n coordinator, and pull from him/her from time to time, just like the way gitk and git-gui are managed.

We could certainly set up something like that. I going to wait and see if we needed it before proposing such a thing.

After an initial spur of translation submissions po/ will probably quiet down quickly. We aren't adding new strings that often, so updating translations shouldn't represent much PATCH traffic on-list.

But it could be split up if that's preferred too.

Quoted 8 lines

For now, I'll queue the whole thing and merge that to 'pu', but we would want to squash l10n commits after (but not including) 8d65a35 (gettext
tests: test re-encoding with a UTF-8 msgid under Shell, 2010-08-30) that touch only one file in po/*.po into one commit per language, move them near the tip after all the infrastructure enhancements (and fix-ups to the infrastructure, if necessary) and individual command i18ns, to make the end result a reasonably complete and clean "first cut for public testing" of the series before it hits 'next'.

I can move those around, I didn't do so already because their position in the series is semantically meaningful. I.e. at the time is.po is added it's pretty much a 100% translation, but more strings are added after that.

That's a trivial minor issue with msgmerge and msgfmt --statistics to find out how much is translated though. So I've re-arranged them and squashed 'em for you here:

    git://github.com/avar/git.git ab/i18n-for-junio
Quoted 4 lines

As a companion update to 6495411 (gettext docs: add po/README file documenting Git's gettext, 2010-09-03), we would need a file in Documentation/ directory to describe the use of _() and N_() for programmers and point it from CodingGuidelines.

I can add that to ab/i18n-for-junio, but haven't already. Isn't it better if I send that to the list for review instead of just tucking something at the end of the series. I can do either.

Quoted 2 lines

We might also want to move po/README to Documentation/ but I don't have strong preference either way.

I'd like to make it a manpage (as mentioned before), but i can't figure out a good git-*.txt name for it.

#30 lore raw

cover gettext docs: programmer docs in po/README

Quoted 9 lines · Ævar Arnfjörð Bjarmason
Quoted 4 lines · Junio C Hamano

As a companion update to 6495411 (gettext docs: add po/README file documenting Git's gettext, 2010-09-03), we would need a file in Documentation/ directory to describe the use of _() and N_() for programmers and point it from CodingGuidelines.

I can add that to ab/i18n-for-junio, but haven't already. Isn't it better if I send that to the list for review instead of just tucking something at the end of the series. I can do either.

Here it is on top of ab/i18n-for-junio. These can also be fetched from:

git://github.com/avar/git.git ab/i18n-for-junio-with-docs

Ævar Arnfjörð Bjarmason (5):
gettext docs: add a "Testing your changes" section to po/README gettext docs: add "Marking strings for translation" section in
po/README
gettext docs: the gettext.h C interface
gettext docs: the git-sh-i18n.sh Shell interface gettext docs: the Git::I18N Perl interface

 Documentation/CodingGuidelines |    7 ++
 git-sh-i18n.sh                 |   16 +-----
 po/README                      |  125 +++++++++++++++++++++++++++++++++++++++-
 3 files changed, 133 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.2.3.313.gcd15
#32 lore raw

PATCH 1/5 gettext docs: add a "Testing your changes" section to po/README

In reply to Ævar Arnfjörð Bjarmason

Change po/README to tell translators that they should do make at the top-level before submitting their translations. Many common errors will be caught with the msgfmt --check run that the Makefile will compile the message catalogs with.

---
 po/README |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
po/README +14 -0
index cca8012..4d23ca6 100644
@@ -66,3 +66,17 @@ But then you need remember to remove the comments before you submit
 the file upstream:
 
     perl -pi -e 's/^#: .*\n//' XX.po
+
+
+Testing your changes
+--------------------
+
+Before you submit your changes go back to the top-level and do:
+
+    make
+
+On systems with GNU gettext (i.e. not Solaris) this will compile your
+changed PO file with `msgfmt --check`, the --check option flags many
+common errors, e.g. missing printf format strings, or translated
+messages that deviate from the originals in whether they begin/end
+with a newline or not.
Signature · 1 line
1.7.2.3.313.gcd15
#33 lore raw

PATCH 2/5 gettext docs: add "Marking strings for translation" section in po/README

In reply to Ævar Arnfjörð Bjarmason

Add a "Marking strings for translation" section to po/README and mention it in Documentation/CodingGuidelines.

This section documents how the maintainers of Git's source code should go about properly marking strings for translation.

---
 Documentation/CodingGuidelines |    7 ++++++
 po/README                      |   41 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletions(-)
Documentation/CodingGuidelines +7 -0
index b8bf618..2e114d6 100644
@@ -70,6 +70,10 @@ For shell scripts specifically (not exhaustive):
      are ERE elements not BRE (note that \? and \+ are not even part
      of BRE -- making them accessible from BRE is a GNU extension).
 
+ - Use Git's gettext wrappers in git-sh-i18n to make the user
+   interface translatable. See "Marking strings for translation" in
+   po/README.
+
 For C programs:
 
  - We use tabs to indent, and interpret tabs as taking up to
@@ -132,3 +136,6 @@ For C programs:
 
  - When we pass <string, length> pair to functions, we should try to
    pass them in that order.
+
+ - Use Git's gettext wrappers to make the user interface
+   translatable. See "Marking strings for translation" in po/README.
po/README +40 -1

50 lines not on this page · raw message

Signature · 1 line
1.7.2.3.313.gcd15
#36 lore raw

PATCH 3/5 gettext docs: the gettext.h C interface

In reply to Ævar Arnfjörð Bjarmason

Change po/README's "Marking strings for translation" section so that it covers the gettext.h C interface.

---
 po/README |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
po/README +36 -0
index 372cb9c..ac12637 100644
@@ -119,3 +119,39 @@ General advice:
 
        /* TRANSLATORS: %s will be "revert" or "cherry-pick" */
        die(_("%s: Unable to write new index file"), me);
+
+We provide wrappers for C, Shell and Perl programs. Here's how they're
+used:
+
+C:
+
+ - Include builtin.h at the top, it'll pull in in gettext.h, which
+   defines the gettext interface. Consult with the list if you need to
+   use gettext.h directly.
+
+ - The C interface is a subset of the normal GNU gettext
+   interface. We currently export these functions:
+
+   - _()
+
+    Mark and translate a string. E.g.:
+
+        printf(_("HEAD is now at %s"), hex);
+
+   - N_()
+
+    A no-op pass-through macro for marking strings inside static
+    initializations, e.g.:
+        
+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };
+        
+    And then, later:
+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));
+
+    Here _() couldn't have statically determined what the translation
+    string will be, but since it was already marked for translation
+    with N_() the look-up in the message catalog will succeed.
Signature · 1 line
1.7.2.3.313.gcd15
#43 lore raw

PATCH 4/5 gettext docs: the git-sh-i18n.sh Shell interface

In reply to Ævar Arnfjörð Bjarmason

Change po/README's "Marking strings for translation" section so that it covers the git-sh-i18n.sh Shell interface.

The existing documentation in git-sh-i18n.sh has been moved to the README file, to avoid them drifting in apart..

---
 git-sh-i18n.sh |   16 ++--------------
 po/README      |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 14 deletions(-)
git-sh-i18n.sh +2 -14
index b8b645a..f8dd43a 100644
@@ -2,20 +2,8 @@
 #
 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
 #
-# This is Git's interface to gettext.sh. Use it right after
-# git-sh-setup as:
-#
-#   . git-sh-setup
-#   . git-sh-i18n
-#
-#   # For constant interface messages:
-#   gettext "A message for the user"; echo
-#
-#   # To interpolate variables:
-#   details="oh noes"
-#   eval_gettext "An error occured: \$details"; echo
-#
-# See "info '(gettext)sh'" for the full manual.
+# This is Git's interface to gettext.sh. See po/README for usage
+# instructions.
 
 # Export the TEXTDOMAIN* data that we need for Git
 TEXTDOMAIN=git
po/README +23 -0
index ac12637..513cf32 100644
@@ -155,3 +155,26 @@ C:
     Here _() couldn't have statically determined what the translation
     string will be, but since it was already marked for translation
     with N_() the look-up in the message catalog will succeed.
+
+Shell:
+
+ - The Git gettext shell interface is just a wrapper for
+   gettext.sh. Import it right after git-sh-setup like this:
+
+       . git-sh-setup
+       . git-sh-i18n
+
+   And then use the gettext or eval_gettext functions:
+
+       # For constant interface messages:
+       gettext "A message for the user"; echo
+
+       # To interpolate variables:
+       details="oh noes"
+       eval_gettext "An error occured: \$details"; echo
+
+   More documentation about the interface is available in the GNU info
+   page: `info '(gettext)sh'`. Looking at git-am.sh (the first shell
+   command to be translated) for examples is also useful:
+
+       git log --reverse -p --grep=gettextize git-am.sh
Signature · 1 line
1.7.2.3.313.gcd15
#46 lore raw

PATCH 5/5 gettext docs: the Git::I18N Perl interface

In reply to Ævar Arnfjörð Bjarmason

Change po/README's "Marking strings for translation" section so that it covers the Git::I18N Perl interface.

---
 po/README |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
po/README +11 -0
index 513cf32..0d1cfa0 100644
@@ -178,3 +178,14 @@ Shell:
    command to be translated) for examples is also useful:
 
        git log --reverse -p --grep=gettextize git-am.sh
+
+Perl:
+
+ - The Git::I18N module provides a limited subset of the
+   Locale::Messages functionality, e.g.:
+
+       use Git::I18N;
+       print __("Welcome to Git!\n");
+       printf __("The following error occured: %s\n"), $error;
+
+   Run `perldoc perl/Git/I18N.pm` for more info.
Signature · 1 line
1.7.2.3.313.gcd15
#31 lore raw

Re: [PATCH 0/5] gettext docs: programmer docs in po/README

In reply to Ævar Arnfjörð Bjarmason
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Quoted 6 lines · Ævar Arnfjörð Bjarmason
Quoted 4 lines · Junio C Hamano

As a companion update to 6495411 (gettext docs: add po/README file documenting Git's gettext, 2010-09-03), we would need a file in Documentation/ directory to describe the use of _() and N_() for programmers and point it from CodingGuidelines.

Quoted 8 lines
Quoted 3 lines

I can add that to ab/i18n-for-junio, but haven't already. Isn't it better if I send that to the list for review instead of just tucking something at the end of the series. I can do either.

Here it is on top of ab/i18n-for-junio. These can also be fetched from:

   git://github.com/avar/git.git ab/i18n-for-junio-with-docs

I fixed the wording on this as suggested by Junio, and a trivial whitespace issue, but not the N_() example.

This ref can replace the existing ab/i18n ref in pu.

#34 lore raw

Re: [PATCH 2/5] gettext docs: add "Marking strings for translation" section in po/README

In reply to Ævar Arnfjörð Bjarmason

po/README changed PO file with `msgfmt --check`, the --check option flags many · line 103

Quoted 6 lines · Ævar Arnfjörð Bjarmason

+ - Don't mark everything for translation, only strings which will be

po/README +5 -0
+   read by humans (the porcelain interface) should be translated.
+
+   The output from Git's plumbing utilities will primarily be read by
+   programs and would break scripts under non-C locales. These strings
+   should not be translated.

Hmm, I had to re-read the above twice and then mentally annotate "would break ... _if translated_" to make sense of the advice. Perhaps other people are much less dense than me?

#35 lore raw

Re: [PATCH 2/5] gettext docs: add "Marking strings for translation" section in po/README

Quoted 9 lines · Junio C Hamano
Quoted 6 lines · Ævar Arnfjörð Bjarmason

+ - Don't mark everything for translation, only strings which will be
+   read by humans (the porcelain interface) should be translated. +
+   The output from Git's plumbing utilities will primarily be read by
+   programs and would break scripts under non-C locales. These strings
+   should not be translated.

Quoted 3 lines

Hmm, I had to re-read the above twice and then mentally annotate "would break ... _if translated_" to make sense of the advice.  Perhaps other people are much less dense than me?

No, that "... if translated" wording is better.

#37 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

In reply to Ævar Arnfjörð Bjarmason
Quoted 9 lines · Ævar Arnfjörð Bjarmason
po/README +9 -0
+   - _()
+
+    Mark and translate a string. E.g.:
+
+        printf(_("HEAD is now at %s"), hex);
+
+   - N_()
+
+    A no-op pass-through macro for marking strings inside static

po/README General advice: · line 153

Quoted 10 lines
po/README +10 -0
+    initializations, e.g.:
+        
+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };
+        
+    And then, later:
+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));

I do not think this is a very good example. Unless we are doing l10n of option names, a Portuguese won't be typing "git reset --misto", so there is no point in invoking _(reset_type_names[]) to begin with, and there is no need to mark mixed/soft/hard/... for translation.

And we won't be doing l10n of option names or subcommand names, I hope ;-).

#38 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

Quoted 11 lines · Junio C Hamano

Ævar Arnfjörð Bjarmason <[email protected]> writes:
...

po/README General advice: · line 153

Quoted 8 lines
po/README +8 -0
+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };
+        
+    And then, later:
+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));
Quoted 4 lines

I do not think this is a very good example. Unless we are doing l10n of option names, a Portuguese won't be typing "git reset --misto", so there is no point in invoking _(reset_type_names[]) to begin with, and there is no need to mark mixed/soft/hard/... for translation.

Ahh, I think I should take half of what I said back. The line of thought here is that

(1) the user types "git reset --mixed"; no l10n of option names;

(2) however, various modes of operations in "reset" command have human-readable names, not necessarily cuttable-and-pastable for machine consumption. E.g. "git reset --mixed" is called "mixed reset" in English and that is primarily meant to be explanation of concept in human language, i.e. should be translated.

Under that assumption, localizing reset_type_names[] in the above may make sense.

I said "half of", because I think the example is still problematic if you want to translate to a language where "reset" in the fixed part of the die() message may need to be spelled differently depending on what adjective in reset_type_names[] it takes (or the word order between the noun "reset" and the adjective may have to be different depending on what the adjective is), so an example may probaby need to be more like:

    static const char *error_msgs[] = {
        N_("mixed reset is not allowed..."),
        N_("soft reset is not allowed..."),
        ...
    };

    die("%s", _(error_msgs[reset_type]));
#39 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

Quoted 23 lines · Junio C Hamano
Quoted 15 lines · Junio C Hamano

Ævar Arnfjörð Bjarmason  <[email protected]> writes:
...

po/README General advice: · line 153

Quoted 8 lines

+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };

po/README +5 -0
+
+    And then, later:
+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));

I do not think this is a very good example.  Unless we are doing l10n of option names, a Portuguese won't be typing "git reset --misto", so there is no point in invoking _(reset_type_names[]) to begin with, and there is no need to mark mixed/soft/hard/... for translation.

Ahh, I think I should take half of what I said back.  The line of thought here is that

 (1) the user types "git reset --mixed"; no l10n of option names;

Quoted 8 lines

 (2) however, various modes of operations in "reset" command have human-readable names, not necessarily cuttable-and-pastable for machine consumption.  E.g. "git reset --mixed" is called "mixed reset" in English and that is primarily meant to be explanation of concept in human language, i.e. should be translated.

Under that assumption, localizing reset_type_names[] in the above may make sense.

Yeah.

Quoted 7 lines

I said "half of", because I think the example is still problematic if you want to translate to a language where "reset" in the fixed part of the die() message may need to be spelled differently depending on what adjective in reset_type_names[] it takes (or the word order between the noun "reset" and the adjective may have to be different depending on what the adjective is), so an example may probaby need to be more like:

Quoted 7 lines

   static const char *error_msgs[] = {
       N_("mixed reset is not allowed..."),
       N_("soft reset is not allowed..."),
       ...
   };

   die("%s", _(error_msgs[reset_type]));

That, or we could also solve issues like that to some extent by using the gettext message context, which the limited gettext.h API doesn't support yet, it's probably not useful in this case but in others you could do:

    _("reset-verb", "mixed")

And elsewhere:

    _("reset-noun", "mixed")

And that would turn into:

msgctxt "reset-verb"
msgid "mixed"
msgstr "blandað"

Or something like that.

Anyway, regarding the examples it's the only one of two N_() uses right now, and the builtin/notes.c example is more subtle, and needs more explanation.

So out of lazyness I'd prefer to keep it as-is for now.

#40 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

In reply to Junio C Hamano
Quoted 18 lines · Junio C Hamano
Quoted 16 lines · Ævar Arnfjörð Bjarmason

+   - _()

po/README +15 -0
+
+    Mark and translate a string. E.g.:
+
+        printf(_("HEAD is now at %s"), hex);
+
+   - N_()
+
+    A no-op pass-through macro for marking strings inside static
+    initializations, e.g.:
+
+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };
+
+    And then, later:
Quoted 8 lines
Quoted 3 lines

+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));

I do not think this is a very good example.  Unless we are doing l10n of option names, a Portuguese won't be typing "git reset --misto", so there is no point in invoking _(reset_type_names[]) to begin with, and there is no need to mark mixed/soft/hard/... for translation.

Actually all the code that uses reset_type_names isn't referring to the option directly, but to the action currently being undertaken:

die(_("Cannot do a %s reset in the middle of a merge."),
_(reset_type_names[reset_type]));

die(_("Cannot do %s reset with paths."),
_(reset_type_names[reset_type]));

die(_("%s reset is not allowed in a bare repository"),
_(reset_type_names[reset_type]));

In that context translators probably want to translate them, e.g. I'd translate the first one into Icelandic as:

"Get ekki framkvæmt %s endurstillingu í miðri sameiningu" with %s
== "blandaða" ("mixed")

Quoted 1 line

And we won't be doing l10n of option names or subcommand names, I hope ;-).

We could do that, I don't have plans for it though, and in any case I don't think this is such a case.

#41 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

In reply to Ævar Arnfjörð Bjarmason

po/README General advice:

Quoted 4 lines · Ævar Arnfjörð Bjarmason
po/README +4 -0
+C:
+
+ - Include builtin.h at the top, it'll pull in in gettext.h, which
+   defines the gettext interface.

Hmm, I would have thought that <git-compat-util.h> would be a much more natural place for this kind of thing, not <builtin.h>. Shouldn't you be able to write a non-builtin Porcelain if you wanted to?

#42 lore raw

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

Quoted 10 lines · Junio C Hamano

po/README General advice:

Quoted 4 lines · Ævar Arnfjörð Bjarmason
po/README +4 -0
+C:
+
+ - Include builtin.h at the top, it'll pull in in gettext.h, which
+   defines the gettext interface.

Hmm, I would have thought that <git-compat-util.h> would be a much more natural place for this kind of thing, not <builtin.h>.  Shouldn't you be able to write a non-builtin Porcelain if you wanted to?

I don't know, I just put it in builtin.h for the builtin/*.c commands, the rest of the porcelain stuff should all have gettext.h already.

Maybe gettext.h should be in git-compat-util.h, I don't know.

#44 lore raw

Re: [PATCH 4/5] gettext docs: the git-sh-i18n.sh Shell interface

In reply to Ævar Arnfjörð Bjarmason
Quoted 1 line · Ævar Arnfjörð Bjarmason

+ git log --reverse -p --grep=gettextize git-am.sh

Running this from the tip of ab/i18n reveals that one commit introduces a whitespace breakage ;-).

#45 lore raw

Re: [PATCH 4/5] gettext docs: the git-sh-i18n.sh Shell interface

Quoted 6 lines · Junio C Hamano
Quoted 1 line · Ævar Arnfjörð Bjarmason

+       git log --reverse -p --grep=gettextize git-am.sh

Running this from the tip of ab/i18n reveals that one commit introduces a whitespace breakage ;-).

That breakage was actually intentional (and I *think* I noted it somewhere). The existing "Did you hand edit your patch" in git-am.sh already indented with spaces, and I didn't change it while I was at it to keep the patch on-topic.

I was going to fix a whitespace fixup later.