msgunfmt-tcl-1 revision 1.1.1.1
1#! /bin/sh
2
3# Test of --tcl option.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8# Test whether we can execute Tcl programs and Tcl's fconfigure command
9# understands the -encoding option (it does since approximately Tcl 8.1).
10tmpfiles="$tmpfiles version.tcl"
11cat <<\EOF > version.tcl
12fconfigure stdout -encoding utf-8
13puts $tcl_version
14EOF
15(tclsh version.tcl) >/dev/null 2>/dev/null \
16  || { echo "Skipping test: tclsh not found or Tcl too old"
17       rm -fr $tmpfiles; exit 77
18     }
19
20tmpfiles="$tmpfiles fr.po"
21cat <<\EOF > fr.po
22msgid ""
23msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
24
25#: program.tcl:5
26msgid "'Your command, please?', asked the waiter."
27msgstr "�Votre commande, s'il vous plait�, dit le gar�on."
28
29# Reverse the arguments.
30#: program.tcl:6
31#, tcl-format
32msgid "%s is replaced by %s."
33msgstr "%2$s remplace %1$s."
34EOF
35
36tmpfiles="$tmpfiles msgs"
37test -d msgs || mkdir msgs
38
39: ${MSGFMT=msgfmt}
40${MSGFMT} --tcl -d msgs -l fr fr.po || exit 1
41
42tmpfiles="$tmpfiles prog.out"
43: ${MSGUNFMT=msgunfmt}
44GETTEXTDATADIR=${top_srcdir}/src \
45${MSGUNFMT} --tcl -d msgs -l fr -o prog.out || exit 1
46
47tmpfiles="$tmpfiles prog.ok"
48cat <<\EOF > prog.ok
49msgid ""
50msgstr "Content-Type: text/plain; charset=UTF-8\n"
51
52msgid "'Your command, please?', asked the waiter."
53msgstr "��Votre commande, s'il vous plait��, dit le gar��on."
54
55msgid "%s is replaced by %s."
56msgstr "%2$s remplace %1$s."
57EOF
58: ${DIFF=diff}
59${DIFF} prog.ok prog.out || exit 1
60
61rm -fr $tmpfiles
62
63exit 0
64