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