On Mon, Jan 23, 2012 at 23:12, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote: > Junio C Hamano wrote: > >> make USE_GETTEXT_SCHEME=fallthrough >> >> This will replace the translation routines with fallthrough versions, >> that does not use gettext from the platform. > > Nice implementation. I still don't understand why NO_GETTEXT=YesPlease > should not imply this. Is it to ensure the GETTEXT_SCHEME=gnu mode > gets more testing? I was the only one with an objection to doing that. The main (and I admit, at least slightly irrational) reason being that I simply don't like using fallback functions when the system supplies us with perfectly good functions we can use instead. It means we're less likely to share code / fixes / eyeballs / cache with other programs. I.e. by using envsubst(1) instead of git-sh-i18n--envsubst--variables(1). Ironically this is all my fault by naming the option for turning off translations NO_GETTEXT. What it should be called is DO_NOT_TRANSLATE_OUTPUT, but since we *need* shell functions to output anything it might have used a system gettext library to do that, NO_GETTEXT should have been "I don't have any gettext library, please supply some fallbacks". Which would have meant that for people who simply don't want translated output we'd be using the maintained by upstream envsubst(1) instead of the doomed to bitrot forever hack I ripped out of some old GPL2 version of GNU gettext. Anyway in the grand scheme of things none of this really matters, these patches can all go in as far as I'm concerned. I can submit patches to improve it once the dust has settled if I still care enough. Aside from this I think not having the ability to run a pre-processor on the shellscripts results in some really ugly workarounds. This stuff would be much nicer if we could just generate git-sh-i18n.sh at compile time depending on some autoconf tests or Makefile options. And by hacking up a pre-processor that just searches/replaces all the gettext/eval_gettext calls out of the shell code we could sidestep this whole issue and there wouldn't be any need for fallback functions, ever. This would also result in a real improvement on Windows where exec overhead is much larger. Like this hack, which doesn't even work, but gives you some idea of what we could do: #!/usr/bin/env perl BEGIN { $^I = ""; } sub unescape { my $str = shift; $str =~ s/\\\$/\$/gs; $str; } LINE: while (defined($_ = <ARGV>)) { s["\$\(gettext "([^"]+?)"\)"]["$1"]g; s["\$\(eval_gettext "([^"]+?)"\)"]['"' . unescape($1) . '"']eg; s[eval_gettextln "([^"]+?)"]['echo "' . unescape($1) . '"']eg; s[gettext "([^"]+?)"][printf "%s" "$1"]g; s[gettextln "([^"]+?)"][echo "$1"]g; # s[gettextln "([^"]+?)"][echo "$1"]g; # s/foo/bar/; print; } When run: for f in $(git grep -l gettext -- *.sh); do perl replace-gettext.pl $f; done Produces output like: @@ -351 +351 @@ split_patches () { - clean_abort "$(eval_gettext "Patch format \$patch_format is not supported.")" + clean_abort "Patch format $patch_format is not supported." @@ -353 +353 @@ split_patches () { - clean_abort "$(gettext "Patch format detection failed.")" + clean_abort "Patch format detection failed." @@ -403 +403 @@ do - die "$(gettext "-d option is no longer supported. Do not use.")" + die "-d option is no longer supported. Do not use." @@ -466 +466 @@ then - die "$(eval_gettext "previous rebase directory \$dotest still exists but mbox given.")" + die "previous rebase directory $dotest still exists but mbox given." It would be relatively easy to hack up a basic POSIX shell pre-processor like this that would work on our *.sh files, thus eliminating the need for all of this fallback business. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html