git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jan 20, 2012, 10:40 UTC
Message-ID
<CALxABCZWBtgX736Acoy-CCAz8RJb0EKnHf+7g72dOdVS+BOhSw@mail.gmail.com>
In-Reply-To
<CACBZZX7iiF2um11FvD+MBz=rZb7RrHtCJp3PqexLnSp3-Cbqug@mail.gmail.com>
On Fri, Jan 20, 2012 at 10:50, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 17 quoted lines
> 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.
Well, I dunno. I wouldn't trust anything to this particular "OS vendoer".
> 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, ...

Better at runtime, unless the packager explicitly stated they don't want any of this.

> ... 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 is /usr/bin/gettext.sh
>    $ gettext.sh --version

/usr/bin/gettext.sh (GNU gettext-runtime) 0.18.1 Copyright (C) 2003-2007 Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Bruno Haible

>    $ gettext -h
Nothing. Exit code 127.
>    $ gettext "some test text"
Nothing. Exit code 127.
>    $ . gettext.sh
Nothing. Exit code 0.
>    eval_gettext
Nothing. Exit code 127.
>    $ variable=value eval_gettext "some \$variable"
Nothing. Exit code 127.
> 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
Nothing. Exit code 127.
> 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.

The exit code seems to be a good enough test here, but testing some output (or even translation) would be safer.

I believe gettext (the binary) just doesn't start at all here. Maybe some Cygwin library wrong or missing library. Happens all the time here, as we have different Cygwin installations depending on the currently used toolchain. QNX Momentics, in particular. Different versions of them, and it is too cumbersome to keep them apart.

> 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.

Yes, they do. Can't run them on this problematic system, because they tend to crash it, if run for an undetermined while. On the other system, which can run them, gettext works (it is an older Cygwin installation), so almost all tests pass (some still don't, but for reasons unrelated). Strangely enough, the problematic system can build. So I don't copy the git binaries, they are actually built on that system.

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 15 of 40 in “i18n: disable i18n for shell scripts if NO_GETTEXT defined”
  1. i18n: disable i18n for shell scripts if NO_GETTEXT definedAlex Riesen, Jan 17, 2012
  2. Junio C HamanoJan 17, 2012
  3. Alex RiesenJan 18, 2012
  4. i18n: disable i18n for shell scripts if NO_GETTEXT definedAlex Riesen, Jan 18, 2012
  5. Jonathan NiederJan 19, 2012
  6. Alex RiesenJan 19, 2012
  7. Ævar Arnfjörð BjarmasonJan 18, 2012
  8. Alex RiesenJan 18, 2012
  9. Ævar Arnfjörð BjarmasonJan 18, 2012
  10. Jonathan NiederJan 19, 2012
  11. Junio C HamanoJan 19, 2012
  12. Johannes SixtJan 19, 2012
  13. Junio C HamanoJan 19, 2012
  14. Ævar Arnfjörð BjarmasonJan 20, 2012
  15. Alex RiesenJan 20, 2012
  16. git-sh-i18n: detect and avoid broken gettext(1) implementationÆvar Arnfjörð Bjarmason, Jan 20, 2012
  17. Alex RiesenJan 20, 2012
  18. Junio C HamanoJan 20, 2012
  19. Alex RiesenJan 20, 2012
  20. Junio C HamanoJan 20, 2012
  21. Alex RiesenJan 20, 2012
  22. Junio C HamanoJan 20, 2012
  23. Alex RiesenJan 20, 2012
  24. Junio C HamanoJan 20, 2012
  25. Alex RiesenJan 20, 2012
  26. Alex RiesenJan 19, 2012
  27. Alex RiesenJan 19, 2012
  28. add a Makefile switch to avoid gettext translation in shell scriptsAlex Riesen, Jan 19, 2012
  29. Junio C HamanoJan 23, 2012
  30. 1/2 git-sh-i18n: restructure the logic to compute gettext.sh schemeJunio C Hamano, Jan 23, 2012
  31. 2/2 add a Makefile switch to avoid gettext translation in shell scriptsJunio C Hamano, Jan 23, 2012
  32. Jonathan NiederJan 23, 2012
  33. Junio C HamanoJan 23, 2012
  34. Jonathan NiederJan 23, 2012
  35. 3/2 i18n: do not use gettext.sh by default when NO_GETTEXT is setJonathan Nieder, Jan 24, 2012
  36. Alex RiesenJan 24, 2012
  37. Ævar Arnfjörð BjarmasonJan 24, 2012
  38. Alex RiesenJan 24, 2012
  39. Alex RiesenJan 24, 2012
  40. Junio C HamanoJan 24, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.