No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / lang-librep
blob5b8840ac76864fc1c0de613094d770367ac7facb
1 #! /bin/sh
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.
7 tmpfiles=""
8 trap 'rm -fr $tmpfiles' 1 2 3 15
10 tmpfiles="$tmpfiles prog.jl"
11 cat <<\EOF > prog.jl
12 (require 'rep.i18n.gettext)
14 (textdomain "prog")
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"))
21 EOF
23 tmpfiles="$tmpfiles prog.pot"
24 : ${XGETTEXT=xgettext}
25 ${XGETTEXT} -o prog.pot --omit-header --no-location prog.jl
27 tmpfiles="$tmpfiles prog.ok"
28 cat <<EOF > prog.ok
29 msgid "'Your command, please?', asked the waiter."
30 msgstr ""
32 #, librep-format
33 msgid "%s is replaced by %s."
34 msgstr ""
35 EOF
37 : ${DIFF=diff}
38 ${DIFF} prog.ok prog.pot || exit 1
40 tmpfiles="$tmpfiles fr.po"
41 cat <<\EOF > fr.po
42 msgid ""
43 msgstr ""
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.
51 #, librep-format
52 msgid "%s is replaced by %s."
53 msgstr "%2$s remplace %1$s."
54 EOF
56 tmpfiles="$tmpfiles fr.po.new"
57 : ${MSGMERGE=msgmerge}
58 ${MSGMERGE} -q -o fr.po.new fr.po prog.pot
60 : ${DIFF=diff}
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
67 : ${MSGFMT=msgfmt}
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;;
76 esac
78 # Test which of the fr_FR locales are installed.
79 : ${LOCALE_FR=fr_FR}
80 : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
81 if test $LOCALE_FR != none; then
82 LC_ALL=$LOCALE_FR ./testlocale
83 case $? in
84 0) ;;
85 77) LOCALE_FR=none;;
86 *) exit 1;;
87 esac
89 if test $LOCALE_FR_UTF8 != none; then
90 LC_ALL=$LOCALE_FR_UTF8 ./testlocale
91 case $? in
92 0) ;;
93 77) LOCALE_FR_UTF8=none;;
94 *) exit 1;;
95 esac
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"
102 : ${DIFF=diff}
103 cat <<\EOF > prog.ok
104 «Votre commande, s'il vous plait», dit le garçon.
105 EUR remplace FF.
107 cat <<\EOF > prog.oku
108 «Votre commande, s'il vous plait», dit le garçon.
109 EUR remplace FF.
112 : ${LOCALE_FR=fr_FR}
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
123 rm -fr $tmpfiles
125 exit 0