MOSTLYCLEANFILES = core *.stackdump
TESTS = gettext-1 gettext-2 \
- intl-1 \
+ intl-1 intl-2 \
intl-setlocale-1 \
gettext-4 gettext-5 gettext-6 gettext-7 gettext-8 \
msgattrib-1 msgattrib-2 msgattrib-3 msgattrib-4 msgattrib-5 \
msguniq-a.in msguniq-a.inp msguniq-a.out \
qttest_pl.po qttest_pl.qm \
qttest2_de.po qttest2_de.qm qttest2_de.ts \
- intl-1.po intl-setlocale-1-1.po intl-setlocale-1-2.po \
+ intl-1.po intl-2-1.po intl-2-2.po \
+ intl-setlocale-1-1.po intl-setlocale-1-2.po \
gettext-4.po gettext-5.po gettext-6-1.po gettext-6-2.po gettext-7.po \
gettextpo-1.de.po \
xgettext-1 \
--- /dev/null
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test that gettext() returns the message converted to the locale's encoding.
+
+test -d in-2-1 || mkdir in-2-1
+test -d in-2-1/fr || mkdir in-2-1/fr
+test -d in-2-1/fr/LC_MESSAGES || mkdir in-2-1/fr/LC_MESSAGES
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} -o in-2-1/fr/LC_MESSAGES/tstprog.mo "$abs_srcdir"/intl-2-1.po
+
+test -d in-2-2 || mkdir in-2-2
+test -d in-2-2/fr || mkdir in-2-2/fr
+test -d in-2-2/fr/LC_MESSAGES || mkdir in-2-2/fr/LC_MESSAGES
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} -o in-2-2/fr/LC_MESSAGES/tstprog.mo "$abs_srcdir"/intl-2-2.po
+
+: ${DIFF=diff}
+cat <<EOF > in-2-1.ok
+Käse
+EOF
+cat <<EOF > in-2-2.ok
+Käse
+EOF
+
+: ${LOCALE_FR=fr_FR}
+: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+if test $LOCALE_FR != none; then
+ prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR
+ prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR
+ ../intl-1-prg in-2-1 $LOCALE_FR > in-2.out || Exit 1
+ ${DIFF} in-2-1.ok in-2.out || Exit 1
+ ../intl-1-prg in-2-2 $LOCALE_FR > in-2.out || Exit 1
+ ${DIFF} in-2-1.ok in-2.out || Exit 1
+fi
+if test $LOCALE_FR_UTF8 != none; then
+ prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR_UTF8
+ prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR_UTF8
+ ../intl-1-prg in-2-1 $LOCALE_FR_UTF8 > in-2.out || Exit 1
+ ${DIFF} in-2-2.ok in-2.out || Exit 1
+ ../intl-1-prg in-2-2 $LOCALE_FR_UTF8 > in-2.out || Exit 1
+ ${DIFF} in-2-2.ok in-2.out || Exit 1
+fi
+if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: no french locale is installed"
+ else
+ echo "Skipping test: no french locale is supported"
+ fi
+ Exit 77
+fi
+
+Exit 0