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