Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-properties-1
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test basic functioning with Java .properties syntax.
5
6 test -d mf-p-1 || mkdir mf-p-1
7 test -d mf-p-1/LC_MESSAGES || mkdir mf-p-1/LC_MESSAGES
8
9 cat <<\EOF > mf-p-1-1.properties
10 SYS_(C)\n=MSGFMT(3) portable message object file compiler\nCopyright (C) 1995 Free Software Foundation\nReport bugs to <bug-gnu-utils@gnu.org>\n
11 msg\ 1=msg 1 translation
12 help\ 2\ %d=help 2 translation
13 error\ 3=error 3 translation
14 EOF
15
16 cat <<\EOF > mf-p-1-2.properties
17 # ---
18 mesg\ 4=mesg 4 translation
19 error\ 3=alternate error 3 translation
20 error\ 5=error 5 translation
21 window\ 6=window 6 translation
22 EOF
23
24 # Without use of msgcat, expect a "duplicate message definition" error.
25 : ${MSGFMT=msgfmt}
26 if ${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
28 fi
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}
36 TEXTDOMAINDIR=. 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
40 cat <<EOF > gtmf-p-test1.ok
41 MSGFMT(3) portable message object file compiler
42 Copyright (C) 1995 Free Software Foundation
43 Report bugs to <bug-gnu-utils@gnu.org>
44 EOF
45
46 : ${DIFF=diff}
47 ${DIFF} gtmf-p-test1.ok mf-p-test1.out
48 result=$?
49
50 exit $result