Re: [PATCH] i18n: disable i18n for shell scripts if NO_GETTEXT defined
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:49
Ævar Arnfjörð Bjarmason [off-list ref] writes:
On Wed, Jan 18, 2012 at 19:57, Alex Riesen [off-list ref] wrote: ...quoted
Well, if I say NO_GETTEXT, I kind of want none of local gettext, whether it works, or not.That's not what NO_GETTEXT means, and not what it *should* mean. It means that your output won't be translated, but we might still make use of a locally installed library to provide the gettext() and eval_gettext() functions.
You are right. 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.
Now I haven't done exhaustive tests but this is the sort of slowdown we might be looking at on Linux for output,...
I think we judged that it is OK not to worry about the performance of message generation, back when we decided to take the current approach.
Anyway speed is the least of the issues here, it's not like we're very constrained by spewing out gettext output. I just think we should consider portability more carefully than "it doesn't work on one obscure setup, let's change it everywhere", when actually it's working just fine in most places. ... But in summary: We shouldn't be *always* using fallback functions whether they're the C stuff in compat/* or the gettext fallbacks in git-sh-i18n.sh just because there's some version out there of the system-supplied functions that's broken. It makes sense to prefer the system functions by default in both cases, but when the OS one can be broken or lacking we can just add probes or Makefile options like we do for fnmatch() with the NO_FNMATCH_CASEFOLD switch.
So we need "MY_GETTEXT_IS_BROKEN" to decline the use of system gettext
in addition to "NO_GETTEXT" to ask Git not to translate the messages. Is
that correct?
If that is the case, should we do something like
LANG=C LC_ALL=C
export LANG LC_ALL
in our shell scripts, when building for NO_GETTEXT target?