No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / msgfmt-2
blob8491178ae3c018a31e221f5fb0908467043652ee
1 #! /bin/sh
3 # Test basic functionality, duplicate detection, multiple domains.
5 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
6 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
7 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
8 ac_n= ac_c='
9 ' ac_t=' '
10 else
11 ac_n=-n ac_c= ac_t=
13 else
14 ac_n= ac_c='\c' ac_t=
17 tmpfiles=""
18 trap 'rm -fr $tmpfiles' 1 2 3 15
20 tmpfiles="$tmpfiles LC_MESSAGES"
21 test -d LC_MESSAGES || mkdir LC_MESSAGES
23 tmpfiles="$tmpfiles module1.po module2.po"
24 cat <<EOF > module1.po
25 #default domain "messages.mo"
26 msgid "SYS_(C)\n"
27 msgstr "MSGFMT(3) portable message object file compiler\n"
28 "Copyright (C) 1995 Free Software Foundation\n"
29 "Report bugs to <bug-gnu-utils@gnu.org>\n"
30 msgid "msg 1"
31 msgstr "msg 1 translation"
33 domain "help_dom"
34 msgid "help 2 %d"
35 msgstr "help 2 translation"
37 domain "error_dom"
38 msgid "error 3"
39 msgstr "error 3 translation"
40 EOF
42 cat <<EOF > module2.po
43 # ---
44 #default domain "messages.mo"
45 msgid "mesg 4"
46 msgstr "mesg 4 translation"
48 domain "error_dom"
49 msgid "error 3"
50 msgstr "alternate error 3 translation"
51 msgid "error 5"
52 msgstr "error 5 translation"
54 domain "window_dom"
55 msgid "window 6"
56 msgstr "window 6 translation"
57 EOF
59 # Without use of msgcat, expect a "duplicate message definition" error.
60 : ${MSGFMT=msgfmt}
61 if ${MSGFMT} module1.po module2.po -o LC_MESSAGES/gen.mo 2> /dev/null; then
62 rm -fr $tmpfiles
63 exit 1
66 # With msgcat, it should work.
67 tmpfiles="$tmpfiles modules.po"
68 : ${MSGCAT=msgcat} ${MSGFMT=msgfmt}
69 ${MSGCAT} --use-first module1.po module2.po -o modules.po
70 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
71 ${MSGFMT} modules.po -o LC_MESSAGES/gen.mo
72 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
74 tmpfiles="$tmpfiles mf-test2.out"
75 : ${GETTEXT=gettext}
76 TEXTDOMAINDIR=.. LANGUAGE=tests \
77 ${GETTEXT} --env LC_ALL=en gen 'error 3' > mf-test2.out
79 tmpfiles="$tmpfiles gtmf-test2.ok"
80 echo $ac_n "error 3 translation$ac_c" > gtmf-test2.ok
82 : ${DIFF=diff}
83 ${DIFF} gtmf-test2.ok mf-test2.out
84 result=$?
86 rm -fr $tmpfiles
88 exit $result