#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test of gettext facilities in the librep language.
# Assumes an fr_FR locale is installed.
# Assumes the following packages are installed: librep.
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles prog.jl"
cat <<\EOF > prog.jl
(require 'rep.i18n.gettext)
(format nil (_ "%s is replaced by %s.") "FF" "EUR"))
EOF
-tmpfiles="$tmpfiles prog.tmp prog.pot"
: ${XGETTEXT=xgettext}
-${XGETTEXT} -o prog.tmp --omit-header --no-location prog.jl
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < prog.tmp > prog.pot
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${XGETTEXT} -o prog.tmp --omit-header --no-location prog.jl || exit 1
+LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
-tmpfiles="$tmpfiles prog.ok"
cat <<EOF > prog.ok
msgid "'Your command, please?', asked the waiter."
msgstr ""
: ${DIFF=diff}
${DIFF} prog.ok prog.pot || exit 1
-tmpfiles="$tmpfiles fr.po"
cat <<\EOF > fr.po
msgid ""
msgstr ""
msgstr "%2$s remplace %1$s."
EOF
-tmpfiles="$tmpfiles fr.po.tmp fr.po.new"
: ${MSGMERGE=msgmerge}
-${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
-LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new
-test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
+LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
: ${DIFF=diff}
${DIFF} fr.po fr.po.new || exit 1
-tmpfiles="$tmpfiles fr"
test -d fr || mkdir fr
test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
# Test for presence of rep version 0.15.3 or newer.
(rep --version) >/dev/null 2>/dev/null \
- || { echo "Skipping test: rep not found"; rm -fr $tmpfiles; exit 77; }
+ || { echo "Skipping test: rep not found"; exit 77; }
case `rep --version | sed -e 's/^[^0-9]*//'` in
0.[0-9] | 0.1[0-5] | 0.[0-9].* | 0.1[0-4].* | 0.15.[0-2] )
- echo "Skipping test: rep version too old"; rm -fr $tmpfiles; exit 77;;
+ echo "Skipping test: rep version too old"; exit 77;;
esac
# Test which of the fr_FR locales are installed.
: ${LOCALE_FR=fr_FR}
: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
if test $LOCALE_FR != none; then
- LC_ALL=$LOCALE_FR ./testlocale
+ LC_ALL=$LOCALE_FR ../testlocale
case $? in
0) ;;
77) LOCALE_FR=none;;
esac
fi
if test $LOCALE_FR_UTF8 != none; then
- LC_ALL=$LOCALE_FR_UTF8 ./testlocale
+ LC_ALL=$LOCALE_FR_UTF8 ../testlocale
case $? in
0) ;;
77) LOCALE_FR_UTF8=none;;
else
echo "Skipping test: no french locale is supported"
fi
- rm -fr $tmpfiles; exit 77
+ 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.
: ${LOCALE_FR=fr_FR}
: ${LOCALE_FR_UTF8=fr_FR.UTF-8}
if test $LOCALE_FR != none; then
+ prepare_locale_ fr $LOCALE_FR
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
+ prepare_locale_ fr $LOCALE_FR_UTF8
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
-
exit 0