Fixed wrong path delimiter in exe finding
[git/dscho.git] / git-sh-i18n.sh
blobb4575fb3a109a2973d519c9f03187ca8fe516679
1 #!/bin/sh
3 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
5 # This is Git's interface to gettext.sh. See po/README for usage
6 # instructions.
8 # Export the TEXTDOMAIN* data that we need for Git
9 TEXTDOMAIN=git
10 export TEXTDOMAIN
11 if test -z "$GIT_TEXTDOMAINDIR"
12 then
13 TEXTDOMAINDIR="@@LOCALEDIR@@"
14 else
15 TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
17 export TEXTDOMAINDIR
19 if test -z "$GIT_GETTEXT_POISON"
20 then
21 if test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && type gettext.sh >/dev/null 2>&1
22 then
23 # This is GNU libintl's gettext.sh, we don't need to do anything
24 # else than setting up the environment and loading gettext.sh
25 GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu
26 export GIT_INTERNAL_GETTEXT_SH_SCHEME
28 # Try to use libintl's gettext.sh, or fall back to English if we
29 # can't.
30 . gettext.sh
32 elif test -z "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" && test "$(gettext -h 2>&1)" = "-h"
33 then
34 # We don't have gettext.sh, but there's a gettext binary in our
35 # path. This is probably Solaris or something like it which has a
36 # gettext implementation that isn't GNU libintl.
37 GIT_INTERNAL_GETTEXT_SH_SCHEME=solaris
38 export GIT_INTERNAL_GETTEXT_SH_SCHEME
40 # Solaris has a gettext(1) but no eval_gettext(1)
41 eval_gettext () {
42 gettext "$1" | (
43 export PATH $(git sh-i18n--envsubst --variables "$1");
44 git sh-i18n--envsubst "$1"
48 else
49 # Since gettext.sh isn't available we'll have to define our own
50 # dummy pass-through functions.
52 # Tell our tests that we don't have the real gettext.sh
53 GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
54 export GIT_INTERNAL_GETTEXT_SH_SCHEME
56 gettext () {
57 printf "%s" "$1"
60 eval_gettext () {
61 printf "%s" "$1" | (
62 export PATH $(git sh-i18n--envsubst --variables "$1");
63 git sh-i18n--envsubst "$1"
67 else
68 # Emit garbage under GETTEXT_POISON=YesPlease. Unlike the C tests
69 # this relies on an environment variable
71 GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
72 export GIT_INTERNAL_GETTEXT_SH_SCHEME
74 gettext () {
75 printf "%s" "# GETTEXT POISON #"
78 eval_gettext () {
79 printf "%s" "# GETTEXT POISON #"
83 # Git-specific wrapper functions
84 gettextln () {
85 gettext "$1"
86 echo
89 eval_gettextln () {
90 eval_gettext "$1"
91 echo