3 # Test of gettext facilities in the librep language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: librep.
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles="$tmpfiles prog.jl"
12 (require 'rep.i18n.gettext)
15 (bindtextdomain "prog" ".")
17 (format standard-output "%s\n" (_ "'Your command, please?', asked the waiter."))
19 (format standard-output "%s\n"
20 (format nil (_ "%s is replaced by %s.") "FF" "EUR"))
23 tmpfiles="$tmpfiles prog.tmp prog.pot"
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} -o prog.tmp --omit-header --no-location prog.jl
26 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
27 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot
28 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
30 tmpfiles="$tmpfiles prog.ok"
32 msgid "'Your command, please?', asked the waiter."
36 msgid "%s is replaced by %s."
41 ${DIFF} prog.ok prog.pot || exit 1
43 tmpfiles="$tmpfiles fr.po"
47 "Content-Type: text/plain; charset=ISO-8859-1\n"
48 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
50 msgid "'Your command, please?', asked the waiter."
51 msgstr "«Votre commande, s'il vous plait», dit le garçon."
53 # Reverse the arguments.
55 msgid "%s is replaced by %s."
56 msgstr "%2$s remplace %1$s."
59 tmpfiles="$tmpfiles fr.po.tmp fr.po.new"
60 : ${MSGMERGE=msgmerge}
61 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot
62 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
63 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new
64 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
67 ${DIFF} fr.po fr.po.new || exit 1
69 tmpfiles="$tmpfiles fr"
70 test -d fr || mkdir fr
71 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
74 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
76 # Test for presence of rep version 0.15.3 or newer.
77 (rep --version) >/dev/null 2>/dev/null \
78 || { echo "Skipping test: rep not found"; rm -fr $tmpfiles; exit 77; }
79 case `rep --version | sed -e 's/^[^0-9]*//'` in
80 0.[0-9] | 0.1[0-5] | 0.[0-9].* | 0.1[0-4].* | 0.15.[0-2] )
81 echo "Skipping test: rep version too old"; rm -fr $tmpfiles; exit 77;;
84 # Test which of the fr_FR locales are installed.
86 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
87 if test $LOCALE_FR != none; then
88 LC_ALL=$LOCALE_FR ./testlocale
95 if test $LOCALE_FR_UTF8 != none; then
96 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
99 77) LOCALE_FR_UTF8=none;;
103 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
104 if test -f /usr/bin/localedef; then
105 echo "Skipping test: no french locale is installed"
107 echo "Skipping test: no french locale is supported"
109 rm -fr $tmpfiles; exit 77
112 tmpfiles="$tmpfiles prog.ok prog.oku prog.out"
115 «Votre commande, s'il vous plait», dit le garçon.
118 cat <<\EOF > prog.oku
119 «Votre commande, s'il vous plait», dit le garçon.
124 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
125 if test $LOCALE_FR != none; then
126 LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1
127 ${DIFF} prog.ok prog.out || exit 1
129 if test $LOCALE_FR_UTF8 != none; then
130 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 rep --no-rc --batch prog.jl > prog.out || exit 1
131 ${DIFF} prog.oku prog.out || exit 1