Thread (27 messages) flat view 27 messages, 2 authors, 2016-06-16

Re: [PATCH v2 15/22] i18n: rebase-interactive: mark here-doc strings for translation

From: Vasco Almeida <hidden>
Date: 2016-06-16 02:19:36

Às 19:27 de 23-05-2016, Vasco Almeida escreveu:
quoted hunk ↗ jump to hunk
Add eval_ngettext dummy function to be called by tests when running
under GETTEXT_POISON. Otherwise, tests would fail under gettext poison
because that function could not be found.

[...]
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index e6c3116..c14c303 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -64,6 +64,10 @@ poison)
 	eval_gettext () {
 		printf "%s" "# GETTEXT POISON #"
 	}
+
+	eval_ngettext () {
+		printf "%s" "# GETTEXT POISON #"
+	}
 	;;
 *)
 	gettext () {
Perhaps, I should have added more eval_ngettext dummy functions in other
places in this file. Not exclusively to the poison part of the switch case.

I see Solaris is a special case (gettext_without_eval_gettext), does it
have eval_ngettext? Probably not, since it does not have
eval_gettext(1). In such case, we would call ngettext like it's done for
eval_gettext, assuming Solaris has ngettext.

The relevant part of git-sh-i18n.sh updated with this patch:

# ... and then follow that decision.
case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
gnu)
	# Use libintl's gettext.sh, or fall back to English if we can't.
	. gettext.sh
	;;
gettext_without_eval_gettext)
	# Solaris has a gettext(1) but no eval_gettext(1)
	eval_gettext () {
		gettext "$1" | (
			export PATH $(git sh-i18n--envsubst --variables "$1");
			git sh-i18n--envsubst "$1"
		)
	}
	;;
poison)
	# Emit garbage so that tests that incorrectly rely on translatable
	# strings will fail.
	gettext () {
		printf "%s" "# GETTEXT POISON #"
	}

	eval_gettext () {
		printf "%s" "# GETTEXT POISON #"
	}

	eval_ngettext () {
		printf "%s" "# GETTEXT POISON #"
	}
	;;
*)
	gettext () {
		printf "%s" "$1"
	}

	eval_gettext () {
		printf "%s" "$1" | (
			export PATH $(git sh-i18n--envsubst --variables "$1");
			git sh-i18n--envsubst "$1"
		)
	}
	;;
esac
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help