1*946379e7Schristos#! /bin/sh 2*946379e7Schristos 3*946379e7Schristos# Test that on glibc systems, gettext() works right even with intermediate 4*946379e7Schristos# setlocale() calls. 5*946379e7Schristos 6*946379e7Schristostmpfiles="" 7*946379e7Schristostrap 'rm -fr $tmpfiles' 1 2 3 15 8*946379e7Schristos 9*946379e7Schristos# This test works only on glibc systems. 10*946379e7Schristosgrep '@GLIBC2@.*yes' ../config.status >/dev/null || { 11*946379e7Schristos echo "Skipping test: not a glibc system" 12*946379e7Schristos exit 77 13*946379e7Schristos} 14*946379e7Schristos 15*946379e7Schristos# This test works only on systems that have a de_DE and fr_FR locale installed. 16*946379e7SchristosLC_ALL=de_DE ./testlocale || { 17*946379e7Schristos if test -f /usr/bin/localedef; then 18*946379e7Schristos echo "Skipping test: locale de_DE not installed" 19*946379e7Schristos else 20*946379e7Schristos echo "Skipping test: locale de_DE not supported" 21*946379e7Schristos fi 22*946379e7Schristos exit 77 23*946379e7Schristos} 24*946379e7SchristosLC_ALL=fr_FR ./testlocale || { 25*946379e7Schristos if test -f /usr/bin/localedef; then 26*946379e7Schristos echo "Skipping test: locale fr_FR not installed" 27*946379e7Schristos else 28*946379e7Schristos echo "Skipping test: locale fr_FR not supported" 29*946379e7Schristos fi 30*946379e7Schristos exit 77 31*946379e7Schristos} 32*946379e7Schristos 33*946379e7Schristostmpfiles="$tmpfiles de_DE fr_FR" 34*946379e7Schristostest -d de_DE || mkdir de_DE 35*946379e7Schristostest -d de_DE/LC_MESSAGES || mkdir de_DE/LC_MESSAGES 36*946379e7Schristostest -d fr_FR || mkdir fr_FR 37*946379e7Schristostest -d fr_FR/LC_MESSAGES || mkdir fr_FR/LC_MESSAGES 38*946379e7Schristos 39*946379e7Schristos: ${MSGFMT=msgfmt} 40*946379e7Schristos${MSGFMT} -o de_DE/LC_MESSAGES/tstlang.mo ${top_srcdir}/tests/gettext-3-1.po 41*946379e7Schristos${MSGFMT} -o fr_FR/LC_MESSAGES/tstlang.mo ${top_srcdir}/tests/gettext-3-2.po 42*946379e7Schristos 43*946379e7Schristostmpfiles="$tmpfiles gt-3.ok" 44*946379e7Schristoscat <<EOF > gt-3.ok 45*946379e7SchristosString1 - Lang1: 1st string 46*946379e7SchristosString2 - Lang1: 2nd string 47*946379e7SchristosString1 - Lang2: 1st string 48*946379e7SchristosString2 - Lang2: 2nd string 49*946379e7SchristosString1 - First string for testing. 50*946379e7SchristosString2 - Another string for testing. 51*946379e7SchristosEOF 52*946379e7Schristos 53*946379e7Schristostmpfiles="$tmpfiles gt-3.out" 54*946379e7Schristos./gettext-3-prg > gt-3.out || exit 1 55*946379e7Schristos 56*946379e7Schristos: ${DIFF=diff} 57*946379e7Schristos${DIFF} gt-3.ok gt-3.out || exit 1 58*946379e7Schristos 59*946379e7Schristosrm -fr $tmpfiles 60*946379e7Schristos 61*946379e7Schristosexit 0 62