1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test basic functioning with Java .properties syntax. 5 6test -d mf-p-1 || mkdir mf-p-1 7test -d mf-p-1/LC_MESSAGES || mkdir mf-p-1/LC_MESSAGES 8 9cat <<\EOF > mf-p-1-1.properties 10SYS_(C)\n=MSGFMT(3) portable message object file compiler\nCopyright (C) 1995 Free Software Foundation\nReport bugs to <bug-gnu-utils@gnu.org>\n 11msg\ 1=msg 1 translation 12help\ 2\ %d=help 2 translation 13error\ 3=error 3 translation 14EOF 15 16cat <<\EOF > mf-p-1-2.properties 17# --- 18mesg\ 4=mesg 4 translation 19error\ 3=alternate error 3 translation 20error\ 5=error 5 translation 21window\ 6=window 6 translation 22EOF 23 24# Without use of msgcat, expect a "duplicate message definition" error. 25: ${MSGFMT=msgfmt} 26if ${MSGFMT} --properties-input -o mf-p-1/LC_MESSAGES/gen.mo mf-p-1-1.properties mf-p-1-2.properties 2> /dev/null; then 27 Exit 1 28fi 29 30# With msgcat, it should work. 31: ${MSGCAT=msgcat} ${MSGFMT=msgfmt} 32${MSGCAT} --properties-input --properties-output --use-first -o mf-p-1-s.properties mf-p-1-1.properties mf-p-1-2.properties || Exit 1 33${MSGFMT} --properties-input -o mf-p-1/LC_MESSAGES/gen.mo mf-p-1-s.properties || Exit 1 34 35: ${GETTEXT=gettext} 36TEXTDOMAINDIR=. LANGUAGE=mf-p-1 \ 37${GETTEXT} --env LC_ALL=en gen 'SYS_(C) 38' | LC_ALL=C tr -d '\r' > mf-p-test1.out 39 40cat <<EOF > gtmf-p-test1.ok 41MSGFMT(3) portable message object file compiler 42Copyright (C) 1995 Free Software Foundation 43Report bugs to <bug-gnu-utils@gnu.org> 44EOF 45 46: ${DIFF=diff} 47${DIFF} gtmf-p-test1.ok mf-p-test1.out 48result=$? 49 50exit $result 51