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