summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/msgunfmt-tcl-1
blob: ab493d7916ce6d24e9c29c6beae952f016b49b8f (plain)
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
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# 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.

# Test whether we can execute Tcl programs and Tcl's fconfigure command
# understands the -encoding option (it does since approximately Tcl 8.1).
cat <<\EOF > mu-tcl-1-version.tcl
fconfigure stdout -encoding utf-8
puts $tcl_version
EOF
(tclsh mu-tcl-1-version.tcl) >/dev/null 2>/dev/null \
  || { echo "Skipping test: tclsh not found or Tcl too old"
       exit 77
     }

cat <<\EOF > mu-tcl-1-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

test -d mu-tcl-1-msgs || mkdir mu-tcl-1-msgs

: ${MSGFMT=msgfmt}
${MSGFMT} --tcl -d mu-tcl-1-msgs -l fr mu-tcl-1-fr.po || exit 1

: ${MSGUNFMT=msgunfmt}
GETTEXTDATADIR="$abs_top_srcdir"/src \
${MSGUNFMT} --tcl -d mu-tcl-1-msgs -l fr -o mu-tcl-1-prog.out || exit 1

cat <<\EOF > mu-tcl-1-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} mu-tcl-1-prog.ok mu-tcl-1-prog.out || exit 1

exit 0