Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:49

Possibly related (same subject, not in this thread)

Alex Riesen [off-list ref] writes:
From: Alex Riesen <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help