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.pot"
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} -o prog.pot --omit-header --no-location prog.jl
27 tmpfiles="$tmpfiles prog.ok"
29 msgid "'Your
command, please?
', asked the waiter."
33 msgid "%s is replaced by %s."
38 ${DIFF} prog.ok prog.pot || exit 1
40 tmpfiles="$tmpfiles fr.po"
44 "Content-Type: text/plain; charset=ISO-8859-1\n"
45 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
47 msgid "'Your
command, please?
', asked the waiter."
48 msgstr "«Votre commande, s'il vous plait»
, dit le garçon.
"
50 # Reverse the arguments.
52 msgid "%s is replaced by
%s.
"
53 msgstr "%2$s remplace
%1$s.
"
56 tmpfiles="$tmpfiles fr.po.new
"
57 : ${MSGMERGE=msgmerge}
58 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
61 ${DIFF} fr.po fr.po.new || exit 1
63 tmpfiles="$tmpfiles fr
"
64 test -d fr || mkdir fr
65 test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
68 ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po
70 # Test for presence of rep version 0.15.3 or newer.
71 (rep --version) >/dev/null 2>/dev/null \
72 || { rm -fr $tmpfiles; exit 77; }
73 case `rep --version | sed -e 's/^[^0-9]*//'` in
74 0.[0-9] | 0.1[0-5] | 0.[0-9].* | 0.1[0-4].* | 0.15.[0-2] )
75 rm -fr $tmpfiles; exit 77;;
78 # Test which of the fr_FR locales are installed.
80 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
81 if test $LOCALE_FR != none; then
82 LC_ALL=$LOCALE_FR ./testlocale
89 if test $LOCALE_FR_UTF8 != none; then
90 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
93 77) LOCALE_FR_UTF8=none;;
97 if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
98 rm -fr $tmpfiles; exit 77
101 tmpfiles="$tmpfiles prog.ok prog.oku prog.out
"
104 «Votre commande, s'il vous plait», dit le garçon.
107 cat <<\EOF > prog.oku
108 «Votre commande, s'il vous plait», dit le garçon.
113 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
114 if test $LOCALE_FR != none; then
115 LANGUAGE= LC_ALL=$LOCALE_FR rep --no-rc --batch prog.jl > prog.out || exit 1
116 ${DIFF} prog.ok prog.out || exit 1
118 if test $LOCALE_FR_UTF8 != none; then
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