git-sh-i18n.sh: add GIT_GETTEXT_POISON support
Change git-sh-i18n.sh to support the GIT_GETTEXT_POISON environment variable like gettext.c does, this ensures that tests that use git-sh-i18n.sh will fail under GETTEXT_POISON=YesPlease if they rely on Git's C locale messages without declaring that they do. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
May 14, 2011 at 13:47 UTC
64a42951471b03c0e25f9e632973e17e2cc2a758
1 file changed
+21
-9
git-sh-i18n.sh
+21
-9
@@ -5,13 +5,25 @@
5
# This is a skeleton no-op implementation of gettext for Git. It'll be
6
# replaced by something that uses gettext.sh in a future patch series.
7
8
-gettext () {
9
- printf "%s" "$1"
10
-}
8
+if test -z "$GIT_GETTEXT_POISON"
9
+then
10
+ gettext () {
11
+ printf "%s" "$1"
12
+ }
13
+
14
+ eval_gettext () {
15
+ printf "%s" "$1" | (
16
+ export PATH $(git sh-i18n--envsubst --variables "$1");
17
+ git sh-i18n--envsubst "$1"
18
+ )
19
+ }
20
+else
21
+ gettext () {
22
+ printf "%s" "# GETTEXT POISON #"
23
+ }
24
+
25
+ eval_gettext () {
26
+ printf "%s" "# GETTEXT POISON #"
27
+ }
28
+fi
29
12
-eval_gettext () {
13
- printf "%s" "$1" | (
14
- export PATH $(git sh-i18n--envsubst --variables "$1");
15
- git sh-i18n--envsubst "$1"
16
- )
17
-}