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