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.
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles
="$tmpfiles prog.scm"
12 (use-modules
(ice-9 format
))
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"))
27 tmpfiles
="$tmpfiles prog.pot"
28 : ${XGETTEXT=xgettext}
29 ${XGETTEXT} -o prog.pot
--omit-header --no-location prog.scm
31 tmpfiles
="$tmpfiles prog.ok"
33 msgid "'Your command, please?', asked the waiter."
37 msgid "a piece of cake"
38 msgid_plural "~D pieces of cake"
43 msgid "~A is replaced by ~A."
48 ${DIFF} prog.ok prog.pot ||
exit 1
50 tmpfiles
="$tmpfiles fr.po"
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.
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.
69 msgid
"~A is replaced by ~A."
70 msgstr
"~1@*~A remplace ~0@*~A."
73 tmpfiles
="$tmpfiles fr.po.new"
74 : ${MSGMERGE=msgmerge}
75 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
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
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;;
95 # Test which of the fr_FR locales are installed.
97 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
98 if test $LOCALE_FR != none
; then
99 LC_ALL
=$LOCALE_FR .
/testlocale
106 if test $LOCALE_FR_UTF8 != none
; then
107 LC_ALL
=$LOCALE_FR_UTF8 .
/testlocale
110 77) LOCALE_FR_UTF8
=none
;;
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"
121 «Votre commande
, s
'il vous plait», dit le garçon.
125 cat <<\EOF > prog.oku
126 «Votre commande, s'il vous plait»
, dit le garçon.
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