No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / lang-clisp
blobdcd8b88fb0b2c9156c4b120719f1d3c38c99aa81
1 #! /bin/sh
3 # Test of gettext facilities in the CLISP language.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: clisp.
7 tmpfiles=""
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles="$tmpfiles prog.lisp"
11 cat <<\EOF > prog.lisp
12 (setf (textdomain) "prog")
13 (setf (textdomaindir "prog") "./")
15 (setq n (parse-integer (first *args*)))
17 (format t "~A~%" (gettext "'Your command, please?', asked the waiter."))
19 (format t "~@?~%" (ngettext "a piece of cake" "~D pieces of cake" n) n)
21 (format t "~A~%" (format nil (gettext "~A is replaced by ~A.") "FF" "EUR"))
22 EOF
24 tmpfiles="$tmpfiles prog.pot"
25 : ${XGETTEXT=xgettext}
26 ${XGETTEXT} -o prog.pot --omit-header --no-location prog.lisp
28 tmpfiles="$tmpfiles prog.ok"
29 cat <<EOF > prog.ok
30 msgid "'Your command, please?', asked the waiter."
31 msgstr ""
33 #, lisp-format
34 msgid "a piece of cake"
35 msgid_plural "~D pieces of cake"
36 msgstr[0] ""
37 msgstr[1] ""
39 #, lisp-format
40 msgid "~A is replaced by ~A."
41 msgstr ""
42 EOF
44 : ${DIFF=diff}
45 ${DIFF} prog.ok prog.pot || exit 1
47 tmpfiles="$tmpfiles fr.po"
48 cat <<\EOF > fr.po
49 msgid ""
50 msgstr ""
51 "Content-Type: text/plain; charset=ISO-8859-1\n"
52 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
54 msgid "'Your command, please?', asked the waiter."
55 msgstr "«Votre commande, s'il vous plait», dit le garçon."
57 # Les gateaux allemands sont les meilleurs du monde.
58 #, lisp-format
59 msgid "a piece of cake"
60 msgid_plural "~D pieces of cake"
61 msgstr[0] "un morceau de gateau"
62 msgstr[1] "~D morceaux de gateau"
64 # Reverse the arguments.
65 #, lisp-format
66 msgid "~A is replaced by ~A."
67 msgstr "~1@*~A remplace ~0@*~A."
68 EOF
70 tmpfiles="$tmpfiles fr.po.new"
71 : ${MSGMERGE=msgmerge}
72 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
74 : ${DIFF=diff}
75 ${DIFF} fr.po fr.po.new || exit 1
77 tmpfiles="$tmpfiles fr"
78 test -d fr || mkdir fr
79 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
81 : ${MSGFMT=msgfmt}
82 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
84 # Test for presence of clisp version 2.28 or newer with gettext support.
85 # Use clisp for the comparison of the version numbers; neither 'expr' nor 'bc'
86 # can deal with floating-point numbers.
87 (clisp --version) >/dev/null 2>/dev/null \
88 || { rm -fr $tmpfiles; exit 77; }
89 version=`clisp --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
90 case $version in
91 19* | 20*) # older than 2.25
92 rm -fr $tmpfiles; exit 77;;
93 esac
94 version=`echo $version | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
95 clisp -norc -x "(sys::exit #+GETTEXT (not (>= $version 2.28)) #-GETTEXT t)" \
96 >/dev/null \
97 || { rm -fr $tmpfiles; exit 77; }
99 # Test which of the fr_FR locales are installed.
100 : ${LOCALE_FR=fr_FR}
101 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
102 if test $LOCALE_FR != none; then
103 LC_ALL=$LOCALE_FR ./testlocale
104 case $? in
105 0) ;;
106 77) LOCALE_FR=none;;
107 *) exit 1;;
108 esac
110 if test $LOCALE_FR_UTF8 != none; then
111 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
112 case $? in
113 0) ;;
114 77) LOCALE_FR_UTF8=none;;
115 *) exit 1;;
116 esac
118 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
119 rm -fr $tmpfiles; exit 77
122 tmpfiles="$tmpfiles prog.ok prog.oku prog.out"
123 : ${DIFF=diff}
124 cat <<\EOF > prog.ok
125 «Votre commande, s'il vous plait», dit le garçon.
126 2 morceaux de gateau
127 EUR remplace FF.
129 cat <<\EOF > prog.oku
130 «Votre commande, s'il vous plait», dit le garçon.
131 2 morceaux de gateau
132 EUR remplace FF.
135 : ${LOCALE_FR=fr_FR}
136 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
137 if test $LOCALE_FR != none; then
138 CLISP_LANGUAGE= LANGUAGE= LC_ALL=$LOCALE_FR clisp prog.lisp 2 > prog.out || exit 1
139 ${DIFF} prog.ok prog.out || exit 1
141 if test $LOCALE_FR_UTF8 != none; then
142 CLISP_LANGUAGE= LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 clisp prog.lisp 2 > prog.out || exit 1
143 ${DIFF} prog.oku prog.out || exit 1
146 rm -fr $tmpfiles
148 exit 0