3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
5 # This is Git's interface to gettext.sh. Use it right after
11 # # For constant interface messages:
12 # gettext "A message for the user"; echo
14 # # To interpolate variables:
16 # eval_gettext "An error occured: \$details"; echo
18 # See "info '(gettext)sh'" for the full manual.
20 # Export the TEXTDOMAIN* data that we need for Git
23 if [ -z "$GIT_TEXTDOMAINDIR" ]
25 TEXTDOMAINDIR
="@@LOCALEDIR@@"
27 TEXTDOMAINDIR
="$GIT_TEXTDOMAINDIR"
31 if test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && type gettext.sh
>/dev
/null
2>&1
33 # This is GNU libintl's gettext.sh, we don't need to do anything
34 # else than setting up the environment and loading gettext.sh
35 GIT_INTERNAL_GETTEXT_SH_SCHEME
=gnu
36 export GIT_INTERNAL_GETTEXT_SH_SCHEME
38 # Try to use libintl's gettext.sh, or fall back to English if we
41 elif test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && test "$(gettext -h 2>&1)" = "-h"
43 # We don't have gettext.sh, but there's a gettext binary in our
44 # path. This is probably Solaris or something like it which has a
45 # gettext implementation that isn't GNU libintl.
46 GIT_INTERNAL_GETTEXT_SH_SCHEME
=solaris
47 export GIT_INTERNAL_GETTEXT_SH_SCHEME
49 # Solaris has a gettext(1) but no eval_gettext(1)
51 gettext_out
=$
(gettext "$1")
52 gettext_eval
="printf '%s' \"$gettext_out\""
53 printf "%s" "`eval \"$gettext_eval\"`"
56 # Since gettext.sh isn't available we'll have to define our own
57 # dummy pass-through functions.
59 # Tell our tests that we don't have the real gettext.sh
60 GIT_INTERNAL_GETTEXT_SH_SCHEME
=fallthrough
61 export GIT_INTERNAL_GETTEXT_SH_SCHEME
68 gettext_eval
="printf '%s' \"$1\""
69 printf "%s" "`eval \"$gettext_eval\"`"