add a Makefile switch to avoid gettext translation in shell scripts

Some systems have gettext.sh (GNU gettext) installed, but it is either broken or misconfigured in such a way so its output is not usable. In case the users of these systems are unable or not interested in fixing them, setting the new Makefile switch should help: make USE_GETTEXT_SCHEME=fallthrough This will replace the translation routines with fallthrough versions, that does not use gettext from the platform. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Alex Riesen committed Jan 23, 2012 at 14:04 UTC ad17ea734770126bfe1027a8a999e9e2d9f62145
2 files changed +9 -2
Makefile
+5 -1
@@ -47,6 +47,9 @@ all::
47 # A translated Git requires GNU libintl or another gettext implementation,
48 # plus libintl-perl at runtime.
49 #
50 +# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
51 +# the installed gettext translation of the shell scripts output.
52 +#
53 # Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
54 # trust the langinfo.h's nl_langinfo(CODESET) function to return the
55 # current character set. GNU and Solaris have a nl_langinfo(CODESET),
@@ -1874,6 +1877,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
1877 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1878 -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
1879 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1880 + -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
1881 -e $(BROKEN_PATH_FIX) \
1882 $@.sh >$@+
1883 endef
@@ -2251,7 +2255,7 @@ cscope:
2255 ### Detect prefix changes
2256 TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):\
2257 $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
2254 - $(localedir_SQ)
2258 + $(localedir_SQ):$(USE_GETTEXT_SCHEME)
2259
2260 GIT-CFLAGS: FORCE
2261 @FLAGS='$(TRACK_CFLAGS)'; \
git-sh-i18n.sh
+4 -1
@@ -18,7 +18,10 @@ export TEXTDOMAINDIR
18
19 # First decide what scheme to use...
20 GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
21 -if test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
21 +if test -n "@@USE_GETTEXT_SCHEME@@"
22 +then
23 + GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
24 +elif test -n "@@USE_FALLTHROUGH_GETTEXT_SCHEME@@$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
25 then
26 : no probing necessary
27 elif test -n "$GIT_GETTEXT_POISON"