xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/msgexec-4 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1#! /bin/sh
2
3# Test msgexec on a PO file with contexts.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles mex-test4.po"
9cat <<\EOF > mex-test4.po
10msgid ""
11msgstr ""
12"Content-Type: text/plain; charset=UTF-8\n"
13"Content-Transfer-Encoding: 8bit\n"
14
15#. A menu item
16msgctxt "File|"
17msgid "Open"
18msgstr "Ouvrir"
19
20#. A menu item
21msgctxt "File|"
22msgid "New"
23msgstr "Nouveau"
24
25#. Denote a lock's state
26msgctxt "Lock state"
27msgid "Open"
28msgstr "Ouvert"
29
30#. Denote a lock's state
31msgctxt "Lock state"
32msgid "Closed"
33msgstr "Fermé"
34
35#. A product
36msgctxt "Audi"
37msgid "car"
38msgstr "voiture"
39
40#. A product
41msgctxt "Océ"
42msgid "copier"
43msgstr "photocopieur"
44
45#~ msgid "Save As"
46#~ msgstr "Enregistrer l'as"
47
48#. A menu item
49#~ msgctxt "File|"
50#~ msgid "Save As"
51#~ msgstr "Enregistrer sous"
52EOF
53
54tmpfiles="$tmpfiles mex-test4.sh"
55cat <<\EOF > mex-test4.sh
56#! /bin/sh
57echo "========================= $MSGEXEC_LOCATION ========================="
58if test -n "${MSGEXEC_MSGCTXT+set}"; then
59  echo "context: $MSGEXEC_MSGCTXT"
60fi
61cat <<MEOF
62$MSGEXEC_MSGID
63---
64MEOF
65cat
66echo
67exit 0
68EOF
69chmod a+x mex-test4.sh
70
71tmpfiles="$tmpfiles mex-test4.out"
72: ${MSGEXEC=msgexec}
73${MSGEXEC} -i mex-test4.po ./mex-test4.sh > mex-test4.out
74test $? = 0 || { rm -fr $tmpfiles; exit 1; }
75
76tmpfiles="$tmpfiles mex-test4.ok"
77cat <<\EOF > mex-test4.ok
78========================= mex-test4.po:2 =========================
79
80---
81Content-Type: text/plain; charset=UTF-8
82Content-Transfer-Encoding: 8bit
83
84========================= mex-test4.po:9 =========================
85context: File|
86Open
87---
88Ouvrir
89========================= mex-test4.po:14 =========================
90context: File|
91New
92---
93Nouveau
94========================= mex-test4.po:19 =========================
95context: Lock state
96Open
97---
98Ouvert
99========================= mex-test4.po:24 =========================
100context: Lock state
101Closed
102---
103Fermé
104========================= mex-test4.po:29 =========================
105context: Audi
106car
107---
108voiture
109========================= mex-test4.po:34 =========================
110context: Océ
111copier
112---
113photocopieur
114========================= mex-test4.po:37 =========================
115Save As
116---
117Enregistrer l'as
118========================= mex-test4.po:42 =========================
119context: File|
120Save As
121---
122Enregistrer sous
123EOF
124
125: ${DIFF=diff}
126${DIFF} mex-test4.ok mex-test4.out
127result=$?
128
129rm -fr $tmpfiles
130
131exit $result
132