Skip to content

Commit 64a4295

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e00cf07 commit 64a4295

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

git-sh-i18n.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55
# This is a skeleton no-op implementation of gettext for Git. It'll be
66
# replaced by something that uses gettext.sh in a future patch series.
77

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
1129

12-
eval_gettext () {
13-
printf "%s" "$1" | (
14-
export PATH $(git sh-i18n--envsubst --variables "$1");
15-
git sh-i18n--envsubst "$1"
16-
)
17-
}

0 commit comments

Comments
 (0)