2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test of gettext facilities in the librep language.
5 # Assumes an fr_FR locale is installed.
6 # Assumes the following packages are installed: librep.
9 (require 'rep.i18n.gettext)
12 (bindtextdomain "prog" ".")
14 (format standard-output "%s\n" (_ "'Your command, please?', asked the waiter."))
16 (format standard-output "%s\n"
17 (format nil (_ "%s is replaced by %s.") "FF" "EUR"))
20 : ${XGETTEXT=xgettext}
21 ${XGETTEXT} -o prog.tmp --omit-header --no-location prog.jl || exit 1
22 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1
25 msgid "'Your command, please?', asked the waiter."
29 msgid "%s is replaced by %s."
34 ${DIFF} prog.ok prog.pot || exit 1
39 "Content-Type: text/plain; charset=ISO-8859-1\n"
40 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
42 msgid "'Your command, please?', asked the waiter."
43 msgstr "«Votre commande, s'il vous plait», dit le garçon."
45 # Reverse the arguments.
47 msgid "%s is replaced by %s."
48 msgstr "%2$s remplace %1$s."
51 : ${MSGMERGE=msgmerge}
52 ${MSGMERGE} -q -o fr.po.tmp fr.po prog.pot || exit 1
53 LC_ALL=C tr -d '\r' < fr.po.tmp > fr.po.new || exit 1
56 ${DIFF} fr.po fr.po.new || exit 1
58 test -d fr || mkdir fr
59 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
62 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
64 # Test for presence of rep version 0.15.3 or newer.
65 (rep --version) >/dev/null 2>/dev/null \
66 || { echo "Skipping test: rep not found"; exit 77; }
67 case `rep --version | sed -e 's/^[^0-9]*//'` in
68 0.[0-9] | 0.1[0-5] | 0.[0-9].* | 0.1[0-4].* | 0.15.[0-2] )
69 echo "Skipping test: rep version too old"; exit 77;;
72 # Test which of the fr_FR locales are installed.
74 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
75 if test $LOCALE_FR != none; then
76 LC_ALL=$LOCALE_FR ../testlocale
83 if test $LOCALE_FR_UTF8 != none; then
84 LC_ALL=$LOCALE_FR_UTF8 ../testlocale
87 77) LOCALE_FR_UTF8=none;;
91 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
92 if test -f /usr/bin/localedef; then
93 echo "Skipping test: no french locale is installed"
95 echo "Skipping test: no french locale is supported"
102 «Votre commande, s'il vous plait», dit le garçon.
105 cat <<\EOF > prog.oku
106 «Votre commande, s'il vous plait», dit le garçon.
111 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
112 if test $LOCALE_FR != none; then
113 prepare_locale_ fr $LOCALE_FR
114 LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1
115 ${DIFF} prog.ok prog.out || exit 1
117 if test $LOCALE_FR_UTF8 != none; then
118 prepare_locale_ fr $LOCALE_FR_UTF8
119 LANGUAGE= LC_ALL=$LOCALE_FR_UTF8 rep --no-rc --batch prog.jl > prog.out || exit 1
120 ${DIFF} prog.oku prog.out || exit 1