Re: [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 17, 2012, 19:08 UTC
- Message-ID
- <7vfwfervt9.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CALxABCZME-g++HxMsD4Nrn1J6s27vN7M_KQSVT3PeLWBqP7qJg@mail.gmail.com>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 12 quoted lines
> From: Alex Riesen <raa.lkml@gmail.com> > Date: Tue, 17 Jan 2012 14:25:24 +0100 > Subject: [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined > > Otherwise the i18n is used in the scripts even with NO_GETTEXT set. > It is very unexpected. > > I generally disable i18n on my working systems as they are generally very > out-of-date and not supported by any sane developer. In particular the > gettext provided with this (very old) Cygwin distribution is fubar and > never produces any output. > ---
Thanks for spotting. I agree that we should honor NO_GETTEXT here.
But the result of the patch looks almost unreadable. could we restructure the script like this instead?
# Decide what to do...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
if test -n "@@NO_GETTEXT@@$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
elif test -n "$GIT_GETTEXT_POISON"
then
GIT_INTERNAL_GETTEXT_SH_SCHEME=poison
elif type gettext.sh >/dev/null 2>&1
then
GIT_INTERNAL_GETTEXT_SH_SCHEME=gnu
elif test "$(gettext -h 2>&1)" = "-h"
then
GIT_INTERNAL_GETTEXT_SH_SCHEME=solaris
fi
export GIT_INTERNAL_GETTEXT_SH_SCHEME # ... and then carry out the decision
case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
gnu)
... gnu definition here ...
;;
solaris)
... solaris cdefinition here ...
;;
poison)
... poison cdefinition here ...
;;
*)
... fallthru definition here ...
;;
esac