diff options
author | Vasco Almeida <vascomalmeida@sapo.pt> | 2016-06-17 20:21:04 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-17 15:45:48 -0700 |
commit | b8fc9e43a7da5c8cb1e90eb569b5e821883c2e06 (patch) | |
tree | 1119fa4fb9e44b42a6475bf79a577838b9e885e5 /git-sh-i18n.sh | |
parent | 9588c52b75c6ec9cc75b045cdec4fe237038615b (diff) | |
download | git-b8fc9e43a7da5c8cb1e90eb569b5e821883c2e06.tar.gz |
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 <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-sh-i18n.sh')
-rw-r--r-- | git-sh-i18n.sh | 18 |
1 files changed, 18 insertions, 0 deletions
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 |