No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / lang-guile
blob79c949599fc323116dc5f4d660203c19fda6bf61
1 #! /bin/sh
3 # Test of gettext facilities in the guile implementation of Scheme.
4 # Assumes an fr_FR locale is installed.
5 # Assumes the following packages are installed: guile.
7 tmpfiles=""
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles="$tmpfiles prog.scm"
11 cat <<\EOF > prog.scm
12 (use-modules (ice-9 format))
14 (setlocale LC_ALL "")
15 (textdomain "prog")
16 (bindtextdomain "prog" ".")
18 (define n (string->number (list-ref (command-line) 1)))
20 (format #t "~A~%" (gettext "'Your command, please?', asked the waiter."))
22 (format #t "~@?~%" (ngettext "a piece of cake" "~D pieces of cake" n) n)
24 (format #t "~A~%" (format #f (gettext "~A is replaced by ~A.") "FF" "EUR"))
25 EOF
27 tmpfiles="$tmpfiles prog.pot"
28 : ${XGETTEXT=xgettext}
29 ${XGETTEXT} -o prog.pot --omit-header --no-location prog.scm
31 tmpfiles="$tmpfiles prog.ok"
32 cat <<EOF > prog.ok
33 msgid "'Your command, please?', asked the waiter."
34 msgstr ""
36 #, scheme-format
37 msgid "a piece of cake"
38 msgid_plural "~D pieces of cake"
39 msgstr[0] ""
40 msgstr[1] ""
42 #, scheme-format
43 msgid "~A is replaced by ~A."
44 msgstr ""
45 EOF
47 : ${DIFF=diff}
48 ${DIFF} prog.ok prog.pot || exit 1
50 tmpfiles="$tmpfiles fr.po"
51 cat <<\EOF > fr.po
52 msgid ""
53 msgstr ""
54 "Content-Type: text/plain; charset=ISO-8859-1\n"
55 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
57 msgid "'Your command, please?', asked the waiter."
58 msgstr "«Votre commande, s'il vous plait», dit le garçon."
60 # Les gateaux allemands sont les meilleurs du monde.
61 #, scheme-format
62 msgid "a piece of cake"
63 msgid_plural "~D pieces of cake"
64 msgstr[0] "un morceau de gateau"
65 msgstr[1] "~D morceaux de gateau"
67 # Reverse the arguments.
68 #, scheme-format
69 msgid "~A is replaced by ~A."
70 msgstr "~1@*~A remplace ~0@*~A."
71 EOF
73 tmpfiles="$tmpfiles fr.po.new"
74 : ${MSGMERGE=msgmerge}
75 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
77 : ${DIFF=diff}
78 ${DIFF} fr.po fr.po.new || exit 1
80 tmpfiles="$tmpfiles fr"
81 test -d fr || mkdir fr
82 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
84 : ${MSGFMT=msgfmt}
85 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
87 # Test for presence of guile version 1.7 or newer.
88 (guile --version) >/dev/null 2>/dev/null \
89 || { rm -fr $tmpfiles; exit 77; }
90 case `guile --version | sed -e 1q | sed -e 's/^[^0-9]*//'` in
91 0.* | 1.[0-6] | 1.[0-6].* )
92 rm -fr $tmpfiles; exit 77;;
93 esac
95 # Test which of the fr_FR locales are installed.
96 : ${LOCALE_FR=fr_FR}
97 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
98 if test $LOCALE_FR != none; then
99 LC_ALL=$LOCALE_FR ./testlocale
100 case $? in
101 0) ;;
102 77) LOCALE_FR=none;;
103 *) exit 1;;
104 esac
106 if test $LOCALE_FR_UTF8 != none; then
107 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
108 case $? in
109 0) ;;
110 77) LOCALE_FR_UTF8=none;;
111 *) exit 1;;
112 esac
114 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
115 rm -fr $tmpfiles; exit 77
118 tmpfiles="$tmpfiles prog.ok prog.oku prog.out"
119 : ${DIFF=diff}
120 cat <<\EOF > prog.ok
121 «Votre commande, s'il vous plait», dit le garçon.
122 2 morceaux de gateau
123 EUR remplace FF.
125 cat <<\EOF > prog.oku
126 «Votre commande, s'il vous plait», dit le garçon.
127 2 morceaux de gateau
128 EUR remplace FF.
131 : ${LOCALE_FR=fr_FR}
132 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
133 if test $LOCALE_FR != none; then
134 LANGUAGE= LC_ALL=$LOCALE_FR guile -s prog.scm 2 > prog.out || exit 1
135 ${DIFF} prog.ok prog.out || exit 1
137 if test $LOCALE_FR_UTF8 != none; then
138 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 guile -s prog.scm 2 > prog.out || exit 1
139 ${DIFF} prog.oku prog.out || exit 1
142 rm -fr $tmpfiles
144 exit 0