Subject: Re: Re*: [PATCH/RFC] Change t0204-gettext-reencode-sanity.sh to pass under Mac OSX

From: Torsten Bögershausen <[email-masked]>
Date: Tue, 13 Mar 2012 20:19:45 +0100

> -- >8 --
> Subject: i18n: fix auto detection of gettext scheme for shell scripts
>
> A new code added by ad17ea7 (add a Makefile switch to avoid gettext
> translation in shell scripts, 2012-01-23) tried to optionally force
> a gettext scheme to "fallthrough", but ended up forcing it to everybody.
>
> Signed-off-by: Junio C Hamano<[email-masked]>
> ---
>   git-sh-i18n.sh |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
> index d5fae99..6a27f68 100644
> --- a/git-sh-i18n.sh
> +++ b/git-sh-i18n.sh
> @@ -21,7 +21,7 @@ GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
>   if test -n "@@USE_GETTEXT_SCHEME@@"
>   then
>   	GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
> -elif test -n "@@USE_FALLTHROUGH_GETTEXT_SCHEME@@$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
> +elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
>   then
>   	: no probing necessary
>   elif test -n "$GIT_GETTEXT_POISON"
> --
Thanks for the patch. Here are the results of t0204:
a) Suse 12.1
# lib-gettext: Found 'is_IS.utf8' as an is_IS UTF-8 locale
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / 
Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / 
Runes (missing GETTEXT_ISO_LOCALE)
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing 
GETTEXT_ISO_LOCALE)
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing 
GETTEXT_ISO_LOCALE)
# passed all 8 test(s)
1..8
====================
b) Ubuntu 10.4:
tb@maxi:~/projects/git/tb/t$ ./t0204-gettext-reencode-sanity.sh
# lib-gettext: No is_IS UTF-8 locale available
# lib-gettext: No is_IS ISO-8859-1 locale available
ok 1 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / 
Icelandic (missing GETTEXT_LOCALE)
ok 2 # skip gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes 
(missing GETTEXT_LOCALE)
ok 3 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / 
Icelandic (missing GETTEXT_ISO_LOCALE)
ok 4 # skip gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / 
Runes (missing GETTEXT_ISO_LOCALE)
ok 5 # skip gettext: Fetching a UTF-8 msgid -> UTF-8 (missing 
GETTEXT_LOCALE)
ok 6 # skip gettext: Fetching a UTF-8 msgid -> ISO-8859-1 (missing 
GETTEXT_ISO_LOCALE)
ok 7 # skip gettext.c: git init UTF-8 -> UTF-8 (missing GETTEXT_LOCALE)
ok 8 # skip gettext.c: git init UTF-8 -> ISO-8859-1 (missing 
GETTEXT_ISO_LOCALE)
# passed all 8 test(s)
1..8
==============
c) Mac OS
# lib-gettext: Found 'is_IS.UTF-8' as an is_IS UTF-8 locale
# lib-gettext: Found 'is_IS.ISO8859-1' as an is_IS ISO-8859-1 locale
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic
not ok - 4 gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes
#
#           LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old 
English Runes" >runes &&
#
#               if grep "^TEST: Old English Runes$" runes
#               then
#                       say "Your system can not handle this complexity 
and returns the string as-is"
#               else
#                       # Both Solaris and GNU libintl will return this 
stream of
#                       # question marks, so it is s probably portable 
enough
#                       printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? 
????? ??????????? ??? ?? ????" >runes-expect &&
#                       test_cmp runes-expect runes
#               fi
#
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 - gettext: Fetching a UTF-8 msgid -> ISO-8859-1
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 - gettext.c: git init UTF-8 -> ISO-8859-1
# failed 1 among 8 test(s)
1..8
==============
(But that was expected, wasn't it? I added your original t0204 patch on 
top of that, and here we go:
==============
# lib-gettext: Found 'is_IS.UTF-8' as an is_IS UTF-8 locale
# lib-gettext: Found 'is_IS.ISO8859-1' as an is_IS ISO-8859-1 locale
ok 1 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic
ok 2 - gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes
ok 3 - gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic
ok 4 - gettext: impossible ISO-8859-1 output
ok 5 - gettext: Fetching a UTF-8 msgid -> UTF-8
ok 6 - gettext: Fetching a UTF-8 msgid -> ISO-8859-1
ok 7 - gettext.c: git init UTF-8 -> UTF-8
ok 8 - gettext.c: git init UTF-8 -> ISO-8859-1
# passed all 8 test(s)
1..8
/Torsten