1 # This shell library is Git's interface to gettext.sh. See po/README
2 # for usage instructions.
4 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
7 # Export the TEXTDOMAIN* data that we need for Git
10 if test -z "$GIT_TEXTDOMAINDIR"
12 TEXTDOMAINDIR
="@@LOCALEDIR@@"
14 TEXTDOMAINDIR
="$GIT_TEXTDOMAINDIR"
18 # First decide what scheme to use...
19 GIT_INTERNAL_GETTEXT_SH_SCHEME
=fallthrough
20 if test -n "$GIT_TEST_GETTEXT_POISON" &&
21 git env--helper
--type=bool
--default=0 --exit-code \
22 GIT_TEST_GETTEXT_POISON
24 GIT_INTERNAL_GETTEXT_SH_SCHEME
=poison
25 elif test -n "@@USE_GETTEXT_SCHEME@@"
27 GIT_INTERNAL_GETTEXT_SH_SCHEME
="@@USE_GETTEXT_SCHEME@@"
28 elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
30 : no probing necessary
31 elif type gettext.sh
>/dev
/null
2>&1
33 # GNU libintl's gettext.sh
34 GIT_INTERNAL_GETTEXT_SH_SCHEME
=gnu
35 elif test "$(gettext -h 2>&1)" = "-h"
37 # gettext binary exists but no gettext.sh. likely to be a gettext
38 # binary on a Solaris or something that is not GNU libintl and
40 GIT_INTERNAL_GETTEXT_SH_SCHEME
=gettext_without_eval_gettext
42 export GIT_INTERNAL_GETTEXT_SH_SCHEME
44 # ... and then follow that decision.
45 case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
47 # Use libintl's gettext.sh, or fall back to English if we can't.
50 gettext_without_eval_gettext
)
51 # Solaris has a gettext(1) but no eval_gettext(1)
54 export PATH $
(git sh-i18n--envsubst
--variables "$1");
55 git sh-i18n--envsubst
"$1"
60 ngettext
"$1" "$2" "$3" |
(
61 export PATH $
(git sh-i18n--envsubst
--variables "$2");
62 git sh-i18n--envsubst
"$2"
67 # Emit garbage so that tests that incorrectly rely on translatable
70 printf "%s" "# GETTEXT POISON #"
74 printf "%s" "# GETTEXT POISON #"
78 printf "%s" "# GETTEXT POISON #"
88 export PATH $
(git sh-i18n--envsubst
--variables "$1");
89 git sh-i18n--envsubst
"$1"
94 (test "$3" = 1 && printf "%s" "$1" ||
printf "%s" "$2") |
(
95 export PATH $
(git sh-i18n--envsubst
--variables "$2");
96 git sh-i18n--envsubst
"$2"
102 # Git-specific wrapper functions