git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Alex Riesen <raa.lkml@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined
Date: Fri, 20 Jan 2012 10:50:23 +0100	[thread overview]
Message-ID: <CACBZZX7iiF2um11FvD+MBz=rZb7RrHtCJp3PqexLnSp3-Cbqug@mail.gmail.com> (raw)
In-Reply-To: <7vhazrk0jx.fsf@alter.siamese.dyndns.org>

On Thu, Jan 19, 2012 at 19:30, Junio C Hamano <gitster@pobox.com> wrote:
> Johannes Sixt <j.sixt@viscovery.net> writes:
>
>> ... We have, e.g., NO_MMAP, and I can set it to request
>> that some alternative is used, even if I have a working mmap(). The option
>> name "NO_GETTEXT" is in exactly the same spirit.
>>
>>> In the current approach we take for shell scripts, we cannot have "No i18n
>>> whatsoever and messages are emit with printf and echo". We always have to
>>> go through gettext/eval_gettext even though they may be an implementation
>>> that does not do i18n at all.
>>
>> Just like we go through _() in C code, even though there may be an
>> implementation that does not do i18n at all, right?
>
> Yes, just like that. The small detail that _() can be #define'd out to
> empty while gettext/eval_gettext cannot be made to be no-impact like that
> does not really matter.
>
>> In C, it is easy, in shell code it may be more involved.
>
> Correct.

To elaborate, the C code can:

 * Use the system gettext library to get translations.

 * Use the system gettext library, but effectively be pass-through
   because the user has the C locale.

 * Use our fallback functions which in any modern compiler will be
   optimized out.

However with the shell code we can:

 1. Be using the system gettext & eval_gettext to get translations.

 2. Be using the system gettext & eval_gettext as pass-through, either
    because we don't have translations since we've installed with
    NO_GETTEXT=YesPlease, or because we're in the C locale.

 3. Haven't detected that gettext.sh etc. exists, so we have to provide
    our own fallbacks.

The proposed patch would move all users of NO_GETTEXT=YesPlease to #3,
even though on most platforms we don't need to define our own dummy
fallbacks since the system already provides them.

I don't particularly like it because I'd rather use the OS vendor's
implementation if possible, even for fallback.

However it being broken is also unacceptable, but I think the way
forward is to detect the breakage either at compile time or at
runtime, to that end Alex could you provide us with the output from
the following commands on the offending system where this is broken:

    $ type gettext.sh
    $ gettext.sh --version
    $ gettext -h
    $ gettext "some test text"
    $ . gettext.sh
    eval_gettext
    $ variable=value eval_gettext "some \$variable"

Then how the eval_gettext function is defined:

    $ type eval_gettext
    eval_gettext is a function
    eval_gettext ()
    {
        gettext "$1" | ( export PATH `envsubst --variables "$1"`;
        envsubst "$1" )
    }

And then a --version for whatever programs that function uses,
e.g. here:

    $ envsubst --version

Once we know how it breaks we can e.g. add configure tests for
checking whether we can use the system's gettext library for the
fallbacks.

Could you also run the git test suite as described in t/README? I'd
expect a lot of the i18n tests to fail, but it would be curious to see
which ones exactly.

  reply	other threads:[~2012-01-20  9:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 13:42 [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined Alex Riesen
2012-01-17 19:08 ` Junio C Hamano
2012-01-18 14:25   ` Alex Riesen
2012-01-18 19:54   ` Alex Riesen
2012-01-19  0:12     ` Jonathan Nieder
2012-01-19  9:15       ` Alex Riesen
2012-01-18 15:22 ` Ævar Arnfjörð Bjarmason
2012-01-18 18:57   ` Alex Riesen
2012-01-18 23:18     ` Ævar Arnfjörð Bjarmason
2012-01-19  0:15       ` Jonathan Nieder
2012-01-19  0:17       ` Junio C Hamano
2012-01-19  7:13         ` Johannes Sixt
2012-01-19 18:30           ` Junio C Hamano
2012-01-20  9:50             ` Ævar Arnfjörð Bjarmason [this message]
2012-01-20 10:40               ` Alex Riesen
2012-01-20 12:49                 ` [PATCH] git-sh-i18n: detect and avoid broken gettext(1) implementation Ævar Arnfjörð Bjarmason
2012-01-20 14:02                   ` Alex Riesen
2012-01-20 20:00                   ` Junio C Hamano
2012-01-20 20:13                     ` Alex Riesen
2012-01-20 20:21                       ` Junio C Hamano
2012-01-20 20:24                         ` Alex Riesen
2012-01-20 20:26                           ` Junio C Hamano
2012-01-20 20:33                             ` Alex Riesen
2012-01-20 19:35                 ` [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined Junio C Hamano
2012-01-20 19:45                   ` Alex Riesen
2012-01-19  9:24         ` Alex Riesen
2012-01-19  9:13       ` Alex Riesen
2012-01-19 19:52         ` [PATCH] add a Makefile switch to avoid gettext translation in shell scripts Alex Riesen
2012-01-23 22:01           ` Junio C Hamano
2012-01-23 22:02             ` [PATCH 1/2] git-sh-i18n: restructure the logic to compute gettext.sh scheme Junio C Hamano
2012-01-23 22:04               ` [PATCH 2/2] add a Makefile switch to avoid gettext translation in shell scripts Junio C Hamano
2012-01-23 22:12                 ` Jonathan Nieder
2012-01-23 22:23                   ` Junio C Hamano
2012-01-23 22:40                     ` Jonathan Nieder
2012-01-24  0:31                     ` [PATCH/RFC 3/2] i18n: do not use gettext.sh by default when NO_GETTEXT is set Jonathan Nieder
2012-01-24 20:06                       ` Alex Riesen
2012-01-24  0:39                   ` [PATCH 2/2] add a Makefile switch to avoid gettext translation in shell scripts Ævar Arnfjörð Bjarmason
2012-01-24 19:59                   ` Alex Riesen
2012-01-24 20:00                 ` Alex Riesen
2012-01-24 20:13                   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACBZZX7iiF2um11FvD+MBz=rZb7RrHtCJp3PqexLnSp3-Cbqug@mail.gmail.com' \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=raa.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).