diff options
25 files changed, 703 insertions, 177 deletions
diff --git a/gettext-tools/ChangeLog b/gettext-tools/ChangeLog index d352d8c..08a1bf3 100644 --- a/gettext-tools/ChangeLog +++ b/gettext-tools/ChangeLog @@ -1,5 +1,9 @@ 2005-02-13 Bruno Haible <bruno@clisp.org> + * configure.ac: Invoke gt_LOCALE_FR_UTF8. + +2005-02-13 Bruno Haible <bruno@clisp.org> + * configure.ac: Invoke gl_FUNC_STRTOUL. Keep AC_CHECK_FUNCS(strtoul) because plural-exp.c needs it. diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac index 8756f3a..9a3536f 100644 --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -240,6 +240,7 @@ AC_SUBST(CROSS_COMPILING) dnl Checks for optional programs for the tests/lang-* tests. gt_PROG_ANSI_CXX gt_LOCALE_FR +gt_LOCALE_FR_UTF8 dnl Check whether to execute tests that rely on libasprintf. dnl This test must be consistent with gettext-runtime/configure.ac. diff --git a/gettext-tools/m4/ChangeLog b/gettext-tools/m4/ChangeLog index daf2d19..f89e6e2 100644 --- a/gettext-tools/m4/ChangeLog +++ b/gettext-tools/m4/ChangeLog @@ -1,5 +1,11 @@ 2005-02-13 Bruno Haible <bruno@clisp.org> + * locale-fr.m4 (gt_LOCALE_FR): If no locale was found or if the OS is + Darwin7, use 'none' instead of 'fr_FR'. + (gt_LOCALE_FR_UTF8): New macro. + +2005-02-13 Bruno Haible <bruno@clisp.org> + * strtoul.m4: New file, from gnulib. * strtol.m4: New file, from gnulib. * Makefile.am (EXTRA_DIST): Add strtol.m4, strtoul.m4. diff --git a/gettext-tools/m4/locale-fr.m4 b/gettext-tools/m4/locale-fr.m4 index 6fcb67d..6c83f9e 100644 --- a/gettext-tools/m4/locale-fr.m4 +++ b/gettext-tools/m4/locale-fr.m4 @@ -1,5 +1,5 @@ -# locale-fr.m4 serial 1 (gettext-0.13) -dnl Copyright (C) 2003 Free Software Foundation, Inc. +# locale-fr.m4 serial 2 (gettext-0.14.2) +dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,9 +9,26 @@ dnl From Bruno Haible. dnl Determine the name of a french locale with traditional encoding. AC_DEFUN([gt_LOCALE_FR], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([for a traditional french locale], gt_cv_locale_fr, [ + macosx= + case "$host_os" in + darwin[56]*) ;; + darwin*) macosx=yes;; + esac + if test -n "$macosx"; then + # On Darwin 7 (MacOS X), the libc supports some locales in non-UTF-8 + # encodings, but the kernel does not support them. The documentation + # says: + # "... all code that calls BSD system routines should ensure + # that the const *char parameters of these routines are in UTF-8 + # encoding. All BSD system functions expect their string + # parameters to be in UTF-8 encoding and nothing else." + # See the comments in config.charset. Therefore we bypass the test. + gt_cv_locale_fr=none + else changequote(,)dnl - cat <<EOF > conftest.$ac_ext + cat <<EOF > conftest.$ac_ext #include <locale.h> #include <time.h> struct tm t; @@ -28,42 +45,103 @@ int main () { } EOF changequote([,])dnl - if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then - # Test for the usual locale name. - if (LC_ALL=fr_FR ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.ISO-8859-1 ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.ISO-8859-1 + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR else - # Test for the AIX, OSF/1, FreeBSD, NetBSD locale name. - if (LC_ALL=fr_FR.ISO8859-1 ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.ISO8859-1 + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO-8859-1 else - # Test for the HP-UX locale name. - if (LC_ALL=fr_FR.iso88591 ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr_FR.iso88591 + # Test for the AIX, OSF/1, FreeBSD, NetBSD locale name. + if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.ISO8859-1 else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr=fr + # Test for the HP-UX locale name. + if (LC_ALL=fr_FR.iso88591 LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr_FR.iso88591 else - # Special test for NetBSD 1.6. - if test -f /usr/share/locale/fr_FR.ISO8859-1/LC_CTYPE; then - gt_cv_locale_fr=fr_FR.ISO8859-1 + # Test for the Solaris 7 locale name. + if (LC_ALL=fr LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr=fr else - # None found. - gt_cv_locale_fr=fr_FR + # Special test for NetBSD 1.6. + if test -f /usr/share/locale/fr_FR.ISO8859-1/LC_CTYPE; then + gt_cv_locale_fr=fr_FR.ISO8859-1 + else + # None found. + gt_cv_locale_fr=none + fi fi fi fi fi fi fi + rm -fr conftest* fi - rm -fr conftest* ]) LOCALE_FR=$gt_cv_locale_fr AC_SUBST([LOCALE_FR]) ]) + +dnl Determine the name of a french locale with UTF-8 encoding. +AC_DEFUN([gt_LOCALE_FR_UTF8], +[ + AC_CACHE_CHECK([for a french Unicode locale], gt_cv_locale_fr_utf8, [ +changequote(,)dnl + cat <<EOF > conftest.$ac_ext +#include <locale.h> +#include <time.h> +struct tm t; +char buf[16]; +int main () { + /* On BeOS, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !defined(__BEOS__) + /* Check whether the given locale name is recognized by the system. */ + if (setlocale (LC_ALL, "") == NULL) return 1; + /* Check whether in the abbreviation of the second month, the second + character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is + two bytes long, with UTF-8 encoding. */ + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%b", &t) < 4 + || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') + return 1; +#endif + return 0; +} +EOF +changequote([,])dnl + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.UTF-8 LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + fi + fi + fi + rm -fr conftest* + ]) + LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + AC_SUBST([LOCALE_FR_UTF8]) +]) diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index f8522fa..46e03a2 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,29 @@ +2005-02-13 Bruno Haible <bruno@clisp.org> + + * Makefile.am (TESTS_ENVIRONMENT): Define also the environment variable + LOCALE_FR_UTF8. + * lang-bash: Don't test using the traditional french locale if it does + exist. Try not only the traditional french locale, but also the UTF-8 + locale, if it exists. + * lang-c: Likewise. + * lang-c++: Likewise. + * lang-clisp: Likewise. + * lang-csharp: Likewise. + * lang-gawk: Likewise. + * lang-guile: Likewise. + * lang-java: Likewise. + * lang-librep: Likewise. + * lang-objc: Likewise. + * lang-perl-1: Likewise. + * lang-perl-2: Likewise. + * lang-php: Likewise. + * lang-sh: Likewise. + * lang-smalltalk: Likewise. + * lang-tcl: Likewise. + * lang-pascal: Likewise, but disable the test of the UTF-8 locale. + * lang-python-1: Likewise. + * lang-python-2: Likewise. + 2005-02-12 Bruno Haible <bruno@clisp.org> * lang-clisp: Use only the first line of "clisp --version"'s output. diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 80d79b4..5d46103 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -149,6 +149,7 @@ TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \ TESTCSHARP='@TESTCSHARP@' \ TESTLIBASPRINTF='@TESTLIBASPRINTF@' \ LOCALE_FR='@LOCALE_FR@' \ + LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ host_os='@host_os@' \ CONFIG_SHELL='$(SHELL)' \ $(SHELL) diff --git a/gettext-tools/tests/lang-bash b/gettext-tools/tests/lang-bash index 0fff7e3..f9397b0 100755 --- a/gettext-tools/tests/lang-bash +++ b/gettext-tools/tests/lang-bash @@ -89,16 +89,30 @@ case `bash -c 'echo $BASH_VERSION'` in *) rm -fr $tmpfiles; exit 77;; esac -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.nok prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.nok prog.ok prog.oku prog.out" # Expected result when bash is built without i18n support. cat <<\EOF > prog.nok 'Your command, please?', asked the waiter. @@ -109,12 +123,25 @@ cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR bash ./prog.sh 2 > prog.out || exit 1 -: ${DIFF=diff} -${DIFF} prog.nok prog.out > /dev/null && { rm -fr $tmpfiles; exit 77; } -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR bash ./prog.sh 2 > prog.out || exit 1 + : ${DIFF=diff} + ${DIFF} prog.nok prog.out > /dev/null && { rm -fr $tmpfiles; exit 77; } + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 bash ./prog.sh 2 > prog.out || exit 1 + : ${DIFF=diff} + ${DIFF} prog.nok prog.out > /dev/null && { rm -fr $tmpfiles; exit 77; } + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-c b/gettext-tools/tests/lang-c index 90ac388..21f1907 100755 --- a/gettext-tools/tests/lang-c +++ b/gettext-tools/tests/lang-c @@ -113,22 +113,40 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= ./prog $LOCALE_FR 2 > prog.out -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= ./prog $LOCALE_FR 2 > prog.out + case $? in + 0) ${DIFF} prog.ok prog.out || exit 1;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out + case $? in + 0) ${DIFF} prog.oku prog.out || exit 1;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-c++ b/gettext-tools/tests/lang-c++ index 496ad2f..59bb399 100755 --- a/gettext-tools/tests/lang-c++ +++ b/gettext-tools/tests/lang-c++ @@ -126,22 +126,40 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= ./prog $LOCALE_FR 2 > prog.out -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= ./prog $LOCALE_FR 2 > prog.out + case $? in + 0) ${DIFF} prog.ok prog.out || exit 1;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out + case $? in + 0) ${DIFF} prog.oku prog.out || exit 1;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-clisp b/gettext-tools/tests/lang-clisp index d8b0460..dcd8b88 100755 --- a/gettext-tools/tests/lang-clisp +++ b/gettext-tools/tests/lang-clisp @@ -96,26 +96,52 @@ clisp -norc -x "(sys::exit #+GETTEXT (not (>= $version 2.28)) #-GETTEXT t)" \ >/dev/null \ || { rm -fr $tmpfiles; exit 77; } -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -CLISP_LANGUAGE= LANGUAGE= LC_ALL=$LOCALE_FR clisp prog.lisp 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + CLISP_LANGUAGE= LANGUAGE= LC_ALL=$LOCALE_FR clisp prog.lisp 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + CLISP_LANGUAGE= LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 clisp prog.lisp 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-csharp b/gettext-tools/tests/lang-csharp index 424c7fc..27a4c86 100755 --- a/gettext-tools/tests/lang-csharp +++ b/gettext-tools/tests/lang-csharp @@ -98,27 +98,53 @@ tmpfiles="$tmpfiles fr/prog.dll" GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \ ${MSGFMT} --csharp -d . -r prog -l fr fr.po || exit 1 -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} : ${CSHARPEXEC="/bin/sh ../lib/csharpexec.sh"} -LANGUAGE= LC_ALL=$LOCALE_FR ${CSHARPEXEC} -L ../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR ${CSHARPEXEC} -L ../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 ${CSHARPEXEC} -L ../../gettext-runtime/intl-csharp program.exe 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-gawk b/gettext-tools/tests/lang-gawk index b81441d..5a104fc 100755 --- a/gettext-tools/tests/lang-gawk +++ b/gettext-tools/tests/lang-gawk @@ -89,31 +89,64 @@ case `gawk --version 2>&1 | sed -e 's/^[^0-9]*//'` in rm -fr $tmpfiles; exit 77;; esac -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi # Test that gawk wasn't built with --disable-nls. : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR gawk --version | grep logiciel > /dev/null -test $? = 0 || { rm -fr $tmpfiles; exit 77; } - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR gawk --version | grep logiciel > /dev/null + test $? = 0 || { rm -fr $tmpfiles; exit 77; } +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gawk --version | grep logiciel > /dev/null + test $? = 0 || { rm -fr $tmpfiles; exit 77; } +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR gawk -v n=2 -f prog.awk > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR gawk -v n=2 -f prog.awk > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gawk -v n=2 -f prog.awk > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-guile b/gettext-tools/tests/lang-guile index a73beab..79c9495 100755 --- a/gettext-tools/tests/lang-guile +++ b/gettext-tools/tests/lang-guile @@ -92,26 +92,52 @@ case `guile --version | sed -e 1q | sed -e 's/^[^0-9]*//'` in rm -fr $tmpfiles; exit 77;; esac -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR guile -s prog.scm 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR guile -s prog.scm 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 guile -s prog.scm 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-java b/gettext-tools/tests/lang-java index 6ef57b2..a9eb2ba 100755 --- a/gettext-tools/tests/lang-java +++ b/gettext-tools/tests/lang-java @@ -110,27 +110,53 @@ tmpfiles="$tmpfiles prog_fr.class" : ${MSGFMT=msgfmt} ${MSGFMT} -j -d . -r prog -l fr fr.po || exit 1 -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} : ${JAVAEXEC="/bin/sh ../lib/javaexec.sh"} -LANGUAGE= LC_ALL=$LOCALE_FR CLASSPATH=.:../../gettext-runtime/intl-java/libintl.jar ${JAVAEXEC} Program 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR CLASSPATH=.:../../gettext-runtime/intl-java/libintl.jar ${JAVAEXEC} Program 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 CLASSPATH=.:../../gettext-runtime/intl-java/libintl.jar ${JAVAEXEC} Program 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-librep b/gettext-tools/tests/lang-librep index fda3e94..5b8840a 100755 --- a/gettext-tools/tests/lang-librep +++ b/gettext-tools/tests/lang-librep @@ -75,25 +75,50 @@ case `rep --version | sed -e 's/^[^0-9]*//'` in rm -fr $tmpfiles; exit 77;; esac -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 rep --no-rc --batch prog.jl > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-objc b/gettext-tools/tests/lang-objc index cc3280f..53f7ae6 100755 --- a/gettext-tools/tests/lang-objc +++ b/gettext-tools/tests/lang-objc @@ -127,22 +127,40 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= ./prog $LOCALE_FR 2 > prog.out -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= ./prog $LOCALE_FR 2 > prog.out + case $? in + 0) ${DIFF} prog.ok prog.out || exit 1;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out + case $? in + 0) ${DIFF} prog.oku prog.out || exit 1;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-pascal b/gettext-tools/tests/lang-pascal index 1f13e48..46cb24a 100755 --- a/gettext-tools/tests/lang-pascal +++ b/gettext-tools/tests/lang-pascal @@ -3,6 +3,11 @@ # Test of gettext facilities in the Object Pascal language. # Assumes the following packages are installed: fpk. +# Note: This test fails with fpk 1.0.10 when an UTF-8 locale is present, +# because fpk ignores the locale's encoding. It supports only unibyte locales. +# This here is a quick workaround: +LOCALE_FR_UTF8=none + tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 @@ -76,17 +81,32 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL= LC_MESSAGES= LC_CTYPE= LANG=$LOCALE_FR ./prog > prog.out || exit 1 -: ${DIFF=diff} -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL= LC_MESSAGES= LC_CTYPE= LANG=$LOCALE_FR ./prog > prog.out || exit 1 + : ${DIFF=diff} + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL= LC_MESSAGES= LC_CTYPE= LANG=$LOCALE_FR_UTF8 ./prog > prog.out || exit 1 + : ${DIFF=diff} + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-perl-1 b/gettext-tools/tests/lang-perl-1 index 8bdbd04..ccd2d85 100755 --- a/gettext-tools/tests/lang-perl-1 +++ b/gettext-tools/tests/lang-perl-1 @@ -57,7 +57,7 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "'Your command, please?', asked the waiter." -msgstr "Votre commande, s'il vous plait, dit le gar�n." +msgstr "«Votre commande, s'il vous plait», dit le garçon." # Les gateaux allemands sont les meilleurs du monde. #, perl-format @@ -86,10 +86,15 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok -Votre commande, s'il vous plait, dit le gar�n. +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF @@ -99,8 +104,18 @@ perl -e 'use Locale::Messages;' 2>/dev/null \ || { rm -fr $tmpfiles; exit 77; } : ${LOCALE_FR=fr_FR} -LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LANG=$LOCALE_FR_UTF8 LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-perl-2 b/gettext-tools/tests/lang-perl-2 index f9868b2..940aaee 100755 --- a/gettext-tools/tests/lang-perl-2 +++ b/gettext-tools/tests/lang-perl-2 @@ -85,21 +85,36 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF # Test for perl with libintl-perl package. perl -M'Locale::TextDomain' -e '' 2>/dev/null \ || { rm -fr $tmpfiles; exit 77; } : ${LOCALE_FR=fr_FR} -LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LANG=$LOCALE_FR_UTF8 LC_MESSAGES= LC_CTYPE= LC_ALL= perl program.pl > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-php b/gettext-tools/tests/lang-php index f5468b8..77de6ce 100755 --- a/gettext-tools/tests/lang-php +++ b/gettext-tools/tests/lang-php @@ -71,25 +71,50 @@ case `(php -v) 2>/dev/null` in *) rm -fr $tmpfiles; exit 77;; esac -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR php -q prog.php > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR php -q prog.php > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 php -q prog.php > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-python-1 b/gettext-tools/tests/lang-python-1 index 7801b2c..40b686e 100755 --- a/gettext-tools/tests/lang-python-1 +++ b/gettext-tools/tests/lang-python-1 @@ -2,6 +2,10 @@ # Test of gettext facilities in the Python language. +# Note: This test fails with Python 2.3, 2.4 when an UTF-8 locale is present. +# It looks like a bug in Python's gettext.py. This here is a quick workaround: +LOCALE_FR_UTF8=none + tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 @@ -72,16 +76,30 @@ case `python -c 'import sys; print sys.hexversion >= 0x20000F0'` in *) rm -fr $tmpfiles; exit 77;; esac -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR python prog.py > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR python prog.py > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 python prog.py > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-python-2 b/gettext-tools/tests/lang-python-2 index 5719f4b..70f889a 100755 --- a/gettext-tools/tests/lang-python-2 +++ b/gettext-tools/tests/lang-python-2 @@ -3,6 +3,10 @@ # Test of gettext facilities (including plural handling) in the Python # language. +# Note: This test fails with Python 2.3, 2.4 when an UTF-8 locale is present. +# It looks like a bug in Python's gettext.py. This here is a quick workaround: +LOCALE_FR_UTF8=none + tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 @@ -91,17 +95,32 @@ case `python -c 'import sys; print sys.hexversion >= 0x20300F0'` in *) rm -fr $tmpfiles; exit 77;; esac -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR python prog.py 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR python prog.py 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 python prog.py 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-sh b/gettext-tools/tests/lang-sh index 000cfec..baca02a 100755 --- a/gettext-tools/tests/lang-sh +++ b/gettext-tools/tests/lang-sh @@ -79,25 +79,50 @@ test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES : ${MSGFMT=msgfmt} ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po -# Test whether the fr_FR locale is installed. +# Test which of the fr_FR locales are installed. : ${LOCALE_FR=fr_FR} -LC_ALL=$LOCALE_FR ./testlocale -case $? in - 0) ;; - 77) rm -fr $tmpfiles; exit 77;; - *) exit 1;; -esac - -tmpfiles="$tmpfiles prog.ok prog.out" +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LC_ALL=$LOCALE_FR ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR_UTF8 != none; then + LC_ALL=$LOCALE_FR_UTF8 ./testlocale + case $? in + 0) ;; + 77) LOCALE_FR_UTF8=none;; + *) exit 1;; + esac +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi + +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. 2 morceaux de gateau EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR sh ./prog.sh 2 > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR sh ./prog.sh 2 > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 sh ./prog.sh 2 > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-smalltalk b/gettext-tools/tests/lang-smalltalk index 53d310c..31ff305 100755 --- a/gettext-tools/tests/lang-smalltalk +++ b/gettext-tools/tests/lang-smalltalk @@ -101,7 +101,7 @@ case `gst --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'` in rm -fr $tmpfiles; exit 77;; esac -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok Loading package I18N @@ -109,10 +109,26 @@ Loading package I18N 2 morceaux de gateau EUR remplace FF. EOF +cat <<\EOF > prog.oku +Loading package I18N +«Votre commande, s'il vous plait», dit le garçon. +2 morceaux de gateau +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LC_ALL=$LOCALE_FR gst -Q prog.st > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LC_ALL=$LOCALE_FR gst -Q prog.st > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 gst -Q prog.st > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles diff --git a/gettext-tools/tests/lang-tcl b/gettext-tools/tests/lang-tcl index a26a041..c4d4b5e 100755 --- a/gettext-tools/tests/lang-tcl +++ b/gettext-tools/tests/lang-tcl @@ -74,16 +74,30 @@ EOF (tclsh version.tcl) >/dev/null 2>/dev/null \ || { rm -fr $tmpfiles; exit 77; } -tmpfiles="$tmpfiles prog.ok prog.out" +tmpfiles="$tmpfiles prog.ok prog.oku prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok «Votre commande, s'il vous plait», dit le garçon. EUR remplace FF. EOF +cat <<\EOF > prog.oku +«Votre commande, s'il vous plait», dit le garçon. +EUR remplace FF. +EOF : ${LOCALE_FR=fr_FR} -LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= tclsh program.tcl > prog.out || exit 1 -${DIFF} prog.ok prog.out || exit 1 +: ${LOCALE_FR_UTF8=fr_FR.UTF-8} +if test $LOCALE_FR != none; then + LANGUAGE= LANG=$LOCALE_FR LC_MESSAGES= LC_CTYPE= LC_ALL= tclsh program.tcl > prog.out || exit 1 + ${DIFF} prog.ok prog.out || exit 1 +fi +if test $LOCALE_FR_UTF8 != none; then + LANGUAGE= LANG=$LOCALE_FR_UTF8 LC_MESSAGES= LC_CTYPE= LC_ALL= tclsh program.tcl > prog.out || exit 1 + ${DIFF} prog.oku prog.out || exit 1 +fi +if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then + rm -fr $tmpfiles; exit 77 +fi rm -fr $tmpfiles |