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
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"
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"
31 msgstr "msg 1 translation"
35 msgstr "help 2 translation"
39 msgstr "error 3 translation"
42 cat <<EOF > module2.po
44 #default domain "messages.mo"
46 msgstr "mesg 4 translation"
50 msgstr "alternate error 3 translation"
52 msgstr "error 5 translation"
56 msgstr "window 6 translation"
59 # Without use of msgcat, expect a "duplicate message definition" error.
61 if ${MSGFMT} -o LC_MESSAGES/gen.mo module1.po module2.po 2> /dev/null; then
66 # With msgcat, it should work.
67 tmpfiles="$tmpfiles modules.po"
68 : ${MSGCAT=msgcat} ${MSGFMT=msgfmt}
69 ${MSGCAT} --use-first -o modules.po module1.po module2.po
70 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
71 ${MSGFMT} -o LC_MESSAGES/gen.mo modules.po
72 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
74 tmpfiles="$tmpfiles mf-test2.out"
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
83 ${DIFF} gtmf-test2.ok mf-test2.out