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