From b8fc9e43a7da5c8cb1e90eb569b5e821883c2e06 Mon Sep 17 00:00:00 2001 From: Vasco Almeida Date: Fri, 17 Jun 2016 20:21:04 +0000 Subject: i18n: rebase-interactive: mark here-doc strings for translation Use pipe to send gettext output to git stripspace instead of the original method of using shell here-document, because command substitution '$(...)' would not take place inside the here-documents. The exception is the case of the last here-document redirecting to cat, in which commands substitution works and, thus, is preserved in this commit. t3404: adapt test to the strings newly marked for translation Test t3404-rebase-interactive.sh would fail under GETTEXT_POISON unless using test_i18ngrep. Add eval_ngettext fallback functions to be called when running, for instance, under GETTEXT_POISON. Otherwise, tests would fail under GETTEXT_POISON, or other build that doesn't support the GNU gettext, because that function could not be found. Signed-off-by: Vasco Almeida Signed-off-by: Junio C Hamano --- git-sh-i18n.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'git-sh-i18n.sh') diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh index e6c3116e18..1ef1889dbd 100644 --- a/git-sh-i18n.sh +++ b/git-sh-i18n.sh @@ -53,6 +53,13 @@ gettext_without_eval_gettext) git sh-i18n--envsubst "$1" ) } + + eval_ngettext () { + ngettext "$1" "$2" "$3" | ( + export PATH $(git sh-i18n--envsubst --variables "$2"); + git sh-i18n--envsubst "$2" + ) + } ;; poison) # Emit garbage so that tests that incorrectly rely on translatable @@ -64,6 +71,10 @@ poison) eval_gettext () { printf "%s" "# GETTEXT POISON #" } + + eval_ngettext () { + printf "%s" "# GETTEXT POISON #" + } ;; *) gettext () { @@ -76,6 +87,13 @@ poison) git sh-i18n--envsubst "$1" ) } + + eval_ngettext () { + (test "$3" = 1 && printf "%s" "$1" || printf "%s" "$2") | ( + export PATH $(git sh-i18n--envsubst --variables "$2"); + git sh-i18n--envsubst "$2" + ) + } ;; esac -- cgit v1.2.3