1#! /bin/sh 2 3# Test basic functionality, duplicate detection, multiple domains. 4 5if (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= 12 fi 13else 14 ac_n= ac_c='\c' ac_t= 15fi 16 17tmpfiles="" 18trap 'rm -fr $tmpfiles' 1 2 3 15 19 20tmpfiles="$tmpfiles LC_MESSAGES" 21test -d LC_MESSAGES || mkdir LC_MESSAGES 22 23tmpfiles="$tmpfiles module1.po module2.po" 24cat <<EOF > module1.po 25#default domain "messages.mo" 26msgid "SYS_(C)\n" 27msgstr "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" 30msgid "msg 1" 31msgstr "msg 1 translation" 32# 33domain "help_dom" 34msgid "help 2 %d" 35msgstr "help 2 translation" 36# 37domain "error_dom" 38msgid "error 3" 39msgstr "error 3 translation" 40EOF 41 42cat <<EOF > module2.po 43# --- 44#default domain "messages.mo" 45msgid "mesg 4" 46msgstr "mesg 4 translation" 47# 48domain "error_dom" 49msgid "error 3" 50msgstr "alternate error 3 translation" 51msgid "error 5" 52msgstr "error 5 translation" 53# 54domain "window_dom" 55msgid "window 6" 56msgstr "window 6 translation" 57EOF 58 59# Without use of msgcat, expect a "duplicate message definition" error. 60: ${MSGFMT=msgfmt} 61if ${MSGFMT} module1.po module2.po -o LC_MESSAGES/gen.mo 2> /dev/null; then 62 rm -fr $tmpfiles 63 exit 1 64fi 65 66# With msgcat, it should work. 67tmpfiles="$tmpfiles modules.po" 68: ${MSGCAT=msgcat} ${MSGFMT=msgfmt} 69${MSGCAT} --use-first module1.po module2.po -o modules.po 70test $? = 0 || { rm -fr $tmpfiles; exit 1; } 71${MSGFMT} modules.po -o LC_MESSAGES/gen.mo 72test $? = 0 || { rm -fr $tmpfiles; exit 1; } 73 74tmpfiles="$tmpfiles mf-test2.out" 75: ${GETTEXT=gettext} 76TEXTDOMAINDIR=.. LANGUAGE=tests \ 77${GETTEXT} --env LC_ALL=en gen 'error 3' > mf-test2.out 78 79tmpfiles="$tmpfiles gtmf-test2.ok" 80echo $ac_n "error 3 translation$ac_c" > gtmf-test2.ok 81 82: ${DIFF=diff} 83${DIFF} gtmf-test2.ok mf-test2.out 84result=$? 85 86rm -fr $tmpfiles 87 88exit $result 89