1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#! /bin/sh
# Test of --tcl option.
# This test fails on mingw, in the Cygwin environment: tclsh exists as
# tclsh.exe from Cygwin. When msgunfmt invokes it, it crashes, presenting
# a dialog "16 bit MS-DOS subsystem - The NTVDM CPU has encountered an
# illegal instruction." When this dialog is closed, msgunfmt continues,
# reads empty output, and refrains from creating a PO file because
# --force-po was not specified.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
# Test whether we can execute Tcl programs and Tcl's fconfigure command
# understands the -encoding option (it does since approximately Tcl 8.1).
tmpfiles="$tmpfiles version.tcl"
cat <<\EOF > version.tcl
fconfigure stdout -encoding utf-8
puts $tcl_version
EOF
(tclsh version.tcl) >/dev/null 2>/dev/null \
|| { echo "Skipping test: tclsh not found or Tcl too old"
rm -fr $tmpfiles; exit 77
}
tmpfiles="$tmpfiles fr.po"
cat <<\EOF > fr.po
msgid ""
msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"
#: program.tcl:5
msgid "'Your command, please?', asked the waiter."
msgstr "«Votre commande, s'il vous plait», dit le garçon."
# Reverse the arguments.
#: program.tcl:6
#, tcl-format
msgid "%s is replaced by %s."
msgstr "%2$s remplace %1$s."
EOF
tmpfiles="$tmpfiles msgs"
test -d msgs || mkdir msgs
: ${MSGFMT=msgfmt}
${MSGFMT} --tcl -d msgs -l fr fr.po || exit 1
tmpfiles="$tmpfiles prog.out"
: ${MSGUNFMT=msgunfmt}
GETTEXTDATADIR=${top_srcdir}/src \
${MSGUNFMT} --tcl -d msgs -l fr -o prog.out || exit 1
tmpfiles="$tmpfiles prog.ok"
cat <<\EOF > prog.ok
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
msgid "'Your command, please?', asked the waiter."
msgstr "«Votre commande, s'il vous plait», dit le garçon."
msgid "%s is replaced by %s."
msgstr "%2$s remplace %1$s."
EOF
: ${DIFF=diff}
${DIFF} prog.ok prog.out || exit 1
rm -fr $tmpfiles
exit 0
|