3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
5 # This is Git's interface to gettext.sh. See po/README for usage
8 # Export the TEXTDOMAIN* data that we need for Git
11 if test -z "$GIT_TEXTDOMAINDIR"
13 TEXTDOMAINDIR="@@LOCALEDIR@@"
15 TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
19 # First decide what scheme to use...
20 GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
21 if test -n "@@USE_GETTEXT_SCHEME@@"
23 GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
24 elif test -n "@@USE_FALLTHROUGH_GETTEXT_SCHEME@@$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
26 : no probing necessary
27 elif test -n "$GIT_GETTEXT_POISON"
29 GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
30 elif type gettext.sh >/dev/null 2>&1
32 # GNU libintl's gettext.sh
33 GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu
34 elif test "$(gettext -h 2>&1)" = "-h"
36 # gettext binary exists but no gettext.sh. likely to be a gettext
37 # binary on a Solaris or something that is not GNU libintl and
39 GIT_INTERNAL_GETTEXT_SH_SCHEME=gettext_without_eval_gettext
41 export GIT_INTERNAL_GETTEXT_SH_SCHEME
43 # ... and then follow that decision.
44 case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
46 # Use libintl's gettext.sh, or fall back to English if we can't.
49 gettext_without_eval_gettext)
50 # Solaris has a gettext(1) but no eval_gettext(1)
53 export PATH $(git sh-i18n--envsubst --variables "$1");
54 git sh-i18n--envsubst "$1"
59 # Emit garbage so that tests that incorrectly rely on translatable
62 printf "%s" "# GETTEXT POISON #"
66 printf "%s" "# GETTEXT POISON #"
76 export PATH $(git sh-i18n--envsubst --variables "$1");
77 git sh-i18n--envsubst "$1"
83 # Git-specific wrapper functions